Simulate the varying conditions
Hello,
I have a small problem for a class of variable conditions for windows, and all windows (XP/2000, Vista, before I do a little ).
Looking at the MSDN I found that using CONDITION_VARIABLE and functions that accompany it were perfect for what I wanted. I found it a bit odd, especially that I was told they had to be simulated, it was not native to windows, but the moment I have not been too careful.
So I then made a class in C + + for use, I compiled with VC it works, I compile with MinGW does not work ...
This is because the variables are only available for systems after XP/2000 and therefore not available with the WinAPI provided with MinGW.
Can it pose me a big problem: how to make a class for the variables for the windows XP/2000/Vista without using CONDITION_VARIABLE which was introduced after XP/2000?
I think we can use events, but I think I remember that I was told that it was not very fast ...
Your help is welcome,
Thank you.
Re: Simulate the varying conditions
To me it looks like event mutex + + WaitForMultipleObjects () with a TRUE bWaitAll ...
Re: Simulate the varying conditions
Hmm, okay, I'm going to have to use events.
I know little to multithreading (I try to save myself) then I have some small questions: I understand why I do not use WaitForMultipleObjects ()? WaitForSingleObject () is not enough? What would I serve the mutex?
again thank you.
Re: Simulate the varying conditions
The condition variable waiting for two things are present at the time, so it requires a WaitForMultipleObjects (). These two things are:
- The condition itself
- The lock that has made to wait for the condition.