What is Condition variable?

A synchronization mechanism that puts a thread to sleep until a condition holds and wakes it on a signal from another thread. The condition must be rechecked after waking.

Field: Multicore & Synchronization

Condition variable in the explanations

Questions that mention Condition variable (1)

  1. When waiting on a condition variable until a queue becomes non-empty, why is the condition rechecked in a while loop rather than an if after waking?

Related terms

ABA problem Acquire-release semantics Atomic instruction Barrier synchronization Bus snooping Compare-and-swap Critical section Data race Deadlock Directory-based coherence

Back to the glossary