On Saturday 23 June 2007 15:08, Tom Phoenix wrote: > On 6/23/07, Michael Scondo <[EMAIL PROTECTED]> wrote: > > sub thread1{ > > print "1\n"; > > lock $x; > > print "locked x: 1\n"; > > cond_wait $x; > > Can't get past here until $x is signalled by another thread, and > unlocked by all other threads. >
> As written, this is the end-of-scope for the lock on $x (as well as > the one on $y). But unless some third thread can rescue these first > two, they seem to be deadlocked, with the first waiting for $x to be > unlocked and the second waiting for $y to be signalled. > Thanks a lot for you explanation ! I didn't read the manual carefully enough.... Therefore I didn't realize that cond_wait locks a variable again AFTER it has been signalled. > As you discovered, using the inner braces will release the lock on $x > soon enough to avoid the deadlock. > > By the way, thanks greatly for the detailed, self-contained test case; > it showed exactly what you were doing. > DNRTFM Did not read the fucking manual... Thanks again for your help, Michael -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/