A Naive question ..
I read before saying - \"A MUTEX has to be unlocked only by the thread that locked it.\"
But I have written a program wh
What you've done is simply not legal, and the behavior is undefined. Mutexes only exclude threads that play by the rules. If you tried to lock mutex1 from thread 2, the thread would be blocked, of course; that's the required thing to do. There's nothing in the spec that says what happens if you try to unlock a mutex you don't own!