Answer by Frank for Windows Critical Section strange behaviour
For me it looks like the topic discussed in http://social.msdn.microsoft.com/forums/en-US/windowssdk/thread/980e5018-3ade-4823-a6dc-5ddbcc3091d5/Please look the example from June 28, 2006(unfortunately...
View ArticleAnswer by Jiri for Windows Critical Section strange behaviour
IMO critical section leave/enter in your example is so fast that another thread is not fast enough to execute enter section during this moment.Try to put some (maybe random) sleeps to slow down code to...
View ArticleAnswer by Daniel Gehriger for Windows Critical Section strange behaviour
Each thread has a specific time slice during which it executes before being preempted. In your example, the time slice seems to be longer than the time required to complete the loop. However, you can...
View ArticleWindows Critical Section strange behaviour
I have two shared global variablesint a = 0;int b = 0;and two threads // thread 1for (int i = 0; i < 10; ++i) { EnterCriticalSection(§); a++; b++; std::cout << a ""<< b <<...
View Article