Use semaphores instead of events on win32.

And correctly unlock during the wait, even if there's holes.

Fixes hangs in 32-bit and potentially dropped condition wakes.

-[Unknown]