Change return type for thread main

This changes the return type to void, as the return type of a thread's
main depends on the threading implementation used. For pthreads, it adds
a wrapper function which returns NULL to avoid problems with bogus
return values. For WinAPI threads, the function is just casted, as bogus
return values don't seem to matter there.
Update buildsys