in reply to Re^10: Threads sharing global variable
in thread Threads sharing global variable
The unlock-and-block part of cond_wait() is atomic; hence, by the time another thread acquires the lock, this first thread is guaranteed to be in a waiting state.
Spurious signals cannot cause a deadlock either — the test condition is lock-protected and can only proceed when other thread has entered cond_wait() (with the cond variable set to the satisfaction of the first thread).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: Threads sharing global variable
by BrowserUk (Patriarch) on Mar 06, 2016 at 15:08 UTC | |
by Anonymous Monk on Mar 06, 2016 at 15:25 UTC | |
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 | |
by Anonymous Monk on Mar 06, 2016 at 15:31 UTC | |
by BrowserUk (Patriarch) on Mar 06, 2016 at 15:37 UTC |