Use semaphores instead of events on win32.

And correctly unlock during the wait, even if there's holes.
Merge pull request #108 from unknownbrackets/semaphore

Use semaphores instead of events on win32