Add a function wrapper for threads on Windows

This is necessary because CreateThread() expects the function to be
stdcall, while the one we get passed is cdecl.