I am trying to make a windows-version of a program written for Linux, in C++. For the program to be thread-safe, I use pthread_cond_t
and pthread_cond_wait
in the Linux version. These functions use a mutex to help make sure that the waiting thread is actually waiting.
I found that CONDITION_VARIABLE
may do the trick in Windows, however I can't figure out why it wont compile. I get the error "error: 'CONDITION_VARIABLE' does not name a type" even though all relevant headers are included, as far as I can tell. I tried copy-pasting the code on http://msdn.microsoft.com/en-us/library/ms686903%28v=VS.85%29.aspx , which wont compile either. I am using GCC.
Any ideas on how to compile this? or any alternate approaches, which doesn't involve condition_variables?