There is a scenario, I have two threads that use the same mutex. One thread blocked the mutex and crashed. What will be the state of the mutex? Is it still locked, and the second thread does not belong to this mutex? Does it mean a deadlock?
Change Also explain the case of pthread on Linux systems.
Since you did not specify which OS, I will tell you what happens in Win32.
Win32 WAIT_ABANDONED, , , . , WAIT_ABANDONED , , . WAIT_ABANDONED , , , . , . , - .
, , , , .
, , ( ) :
, Java synchronized , " " - (. ). :
synchronized
, .
, stop() , , - , , " "? . , - , ; , , , , , .
stop()
: java.util.concurrent.Lock docs finally , , , . , finally, , . , "" .
finally
!
Thanks for your reply. http://msdn.microsoft.com/en-us/library/ms687032%28VS.85%29.aspx MSDN also says that it frees up mutexes, and waiting threads get the status WAIT_ABANDONED.