Fix compiler warnings on OSX. Unsigned div and mod can use C implementation anyway.
Fix names of custom thread functions on os x