Changed condition variables to WaitForSingleObject

For XP support