Improve C threads example

Fixes various compiler warnings.