Implement win32 thread-safety stuff

Patch from Bradley Grainger.
2 files changed