in reply to Re^4: Printing to STDERR causes deadlocks.
in thread Printing to STDERR causes deadlocks.
The $done race was not the only one. Looking at the TRACE output, the warn statements don't get executed uniformly. I guess hat's to be expected, since the threads run asynchronously.
However, when it hangs, I see one of two things: a missed signal or a signal being raised when the other thread isn't waiting.
m-locking m-waiting t-Locking t-Waiting t-Setting t-Signalling # look ma, nobody received my signal! t-Locking t-Waiting # and now we're both blocked, waiting for the other to c +all or (I reconstructed this second scenario from memory) m-processing t-Locking t-Waiting t-Signalling # if a tree signals in a forest, and noone's listening t-Locking t-Waiting m-locking m-waiting # and again, we both wait...
Now threads::shared says the following about the second condition:
Uh... what does it mean "with care"?If there are no threads blocked in a "cond_wait" on the variable, the signal is discarded. By always locking before signaling, you can (with care), avoid signaling before another thread has entered cond_wait().
Two more random notes -
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Printing to STDERR causes deadlocks.
by BrowserUk (Patriarch) on Apr 27, 2005 at 17:28 UTC |