A condition variable is waited on without a predicate or loop, so spurious and missed wake-ups go unnoticed

tx0/cpp:condition-wait-without-predicaterecommendedwarningreliability/concurrencydepth fastbug, concurrency

What it finds

cv.wait(lock) may return without a notification, and a notification sent before the wait is lost. The form with a predicate, cv.wait(lock, [&] { return ready; }), rechecks the condition; a plain wait belongs in a loop that does the same. Waits inside a loop are left alone.

From the rule's source, condition_wait_without_predicate.rs.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:condition-wait-without-predicate" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/cpp:condition-wait-without-predicate] reason="..."

tx0 explain tx0/cpp:condition-wait-without-predicate shows the same in the terminal. Found a false positive? Report it.