1224. condition_variable_any support for recursive mutexes?

Section: 33.5.4 [thread.condition.condvarany] Status: NAD Submitter: Jeffrey Yasskin Opened: 2009-09-30 Last modified: 2016-02-10

Priority: Not Prioritized

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

View all issues with NAD status.

Discussion:

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:

Rationale:

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.