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

### 1219. unique_lock::lock and resource_deadlock_would_occur

Section: 33.6.5.4.3 [thread.lock.unique.locking] Status: Dup Submitter: Jeffrey Yasskin Opened: 2009-09-30 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [thread.lock.unique.locking].

View all issues with Dup status.

Duplicate of: 1159

Discussion:

`unique_lock::lock` and friends raise "`resource_deadlock_would_occur` -- if the current thread already owns the mutex (i.e., on entry, `owns` is `true`)." 1) The current thread owning a mutex is not the same as any particular `unique_lock::owns` being `true`. 2) There's no need to raise this exception for a `recursive_mutex` if `owns` is `false`. 3) If `owns` is true, we need to raise some exception or the unique_lock will lose track of whether to unlock itself on destruction, but "deadlock" isn't it. For (3), s/bool owns/int ownership_level/ would fix it.

[ 2009-11-11 Alisdair notes that this issue is very closely related to 1159, if not a dup. ]

[ 2009-11-14 Moved to Tentatively Dup after 5 positive votes on c++std-lib. ]

Proposed resolution: