in reply to Re^10: Threads sharing global variable (disingenous)
in thread Threads sharing global variable
What they mean by "lost" is that it doesn't do anything if there's noone currently in a cond_wait. By that definition, I agree the signal can be "lost".
Okay. Now we're getting somewhere.
So, if the other thread is still busy, and hasn't looped back to its cond_wait(), by the time 'this' thread calls cond_signal(), then when that other thread DOES reach its cond_wait() it'll block.
Meanwhile, 'this' thread will never signal again, until it has seen a signal from that other thread; which it never will because it'll never come out of its cond_wait() because it missed the signal that would have released it.
The very definition of deadlock.
But that's not a problem.
Hopefully, you now see, it is a problem.
And that is an admission of your 'broken' code; though I'm sure you'll continue to argue.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: Threads sharing global variable (disingenous)
by Anonymous Monk on Mar 09, 2016 at 19:59 UTC | |
by BrowserUk (Patriarch) on Mar 09, 2016 at 20:46 UTC | |
by Anonymous Monk on Mar 09, 2016 at 21:03 UTC | |
by BrowserUk (Patriarch) on Mar 09, 2016 at 21:22 UTC | |
by Anonymous Monk on Mar 09, 2016 at 22:30 UTC | |
|