Implement win32 thread-safety stuff