Missed a pointer.
Replaced the hacky condition variables with the real thing.

See: http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
     Section 3.3.