in reply to Re^12: Threads sharing global variable
in thread Threads sharing global variable
Depending on which thread wins the first lock, the first cond_signal() may be redundant.
That is: If set_positive() won, it proceeds without waiting, and sends the unnecessary signal. This signal is dropped. But the set_zero() thread can then also proceed without cond_wait(), and subsequently sets the ping-pong going with its own cond_signal().
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^14: Threads sharing global variable
by BrowserUk (Patriarch) on Mar 06, 2016 at 15:34 UTC | |
by Anonymous Monk on Mar 06, 2016 at 15:45 UTC | |
by BrowserUk (Patriarch) on Mar 06, 2016 at 16:04 UTC |