Title
Add mutex, recursive_mutex, is_locked function
Status
lewg
Section
[thread.mutex.requirements]
Submitter
INCITS

Created on 2010-08-25.00:00:00 last changed 94 months ago

Messages

Date: 2017-03-15.00:00:00

[ 2017-03-01, Kona ]

SG1 recommends: Close as NAD

Several participants voiced strong objections, based on either memory model issues or lock elision. No support. It is already possible to write a wrapper that explicitly tracks ownership for testing in the owning thread, which may have been part of the intent here.

Date: 2010-11-29.00:35:20

[ 2010 Batavia ]

The Concurrency subgroup reviewed this issue and deemed it to be an extension to be handled after publishing C++0x.

The LWG does not wish to make a change at this time.

Date: 2010-11-01.20:34:22

[ Resolution proposed by ballot comment: ]

Add a member function:

bool is_locked() const;

to std::mutex and std::recursive_mutex. These functions return true if the current thread would not be able to obtain a mutex. These functions do not synchronize with anything (and, thus, can avoid a memory fence).

Date: 2010-10-24.16:08:33

Addresses US-189

mutex and recursive_mutex should have an is_locked() member function. is_locked allows a user to test a lock without acquiring it and can be used to implement a lightweight try_try_lock.

History
Date User Action Args
2017-03-01 18:09:34adminsetmessages: + msg9028
2014-11-24 15:11:58adminsetstatus: nad future -> lewg
2010-11-18 00:17:44adminsetmessages: + msg5379
2010-11-18 00:17:44adminsetstatus: open -> nad future
2010-10-24 16:08:33adminsetmessages: + msg5034
2010-08-25 00:00:00admincreate