This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

1224. condition_variable_any support for recursive mutexes?

Section: 33.7.5 [thread.condition.condvarany] Status: NAD Submitter: Jeffrey Yasskin Opened: 2009-09-30 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [thread.condition.condvarany].

View all issues with NAD status.


For condition_variable_any, are recursive mutexes allowed? (I think "no")

[ 2009-11-17 Moved to Tentatively NAD after 5 positive votes on c++std-lib. Rationale added below. ]

Proposed resolution:


condition_variable_any::wait accepts any type of mutex. It calls unlock precisely once on entry and lock precisely once on exit. It is up to the user to ensure that this provides the required synchronization. Use of a recursive mutex is safe if either its lock count is 1, so after the single unlock it can be acquired by another thread, or another mechanism is used to synchronize the data.