Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The use of cnd_signal() can also be safe in the following situation:

...

if each thread uses a unique condition variable.

The use of cnd_broadcast() solves the problem because it wakes up all the threads associated with the respective condition variable, and since all the threads must reevaluate the predicate condition, one should find its test to be true, avoiding the deadlock situation.

...