Setup proper return type for thread callback

Also make sure to import HANDLE for Windows.
Use correct argument name for WaitForSingleObject call