Mutex does not work on win32/mingw

View: New views
1 Messages — Rating Filter:   Alert me  

Mutex does not work on win32/mingw

by manmach :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It appears that I can enter a mutex from two different threads at the same time, which should of course be impossible.

I have made a very simple program to test this. It consists of a test class derived from Thread, which in simply enters and leaves the mutex once every second.

At the same time the main thread does the same, but twice per second.

As you can see from this little excerpt of the programs output, neither thread blocks when it should:

main(): entering test
2092: entering test
main(): leavingtest
main(): entering test
2092: leavingtest
main(): leavingtest



This is with version 1.5.7, as 1.5.9 won't even compile.

I am using gcc 3.4.2 mingw to compile.

I have built ccgnu2 1.5.7 by running ./configure, make, make install from inside the msys environment.

The exact same code works as expected on Linux (ccgnu 1.5.6 on Ubuntu).
LightInTheBox - Buy quality products at wholesale price!