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

### 962. Various threading bugs #12

Section: 33.6.5.4.3 [thread.lock.unique.locking] Status: C++11 Submitter: Pete Becker Opened: 2009-01-07 Last modified: 2016-01-28

Priority: Not Prioritized

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

View all issues with C++11 status.

Discussion:

33.6.5.4.3 [thread.lock.unique.locking]: `unique_lock::lock` is required to throw an object of type `std::system_error` "when the postcondition cannot be achieved." The postcondition is `owns == true`, and this is trivial to achieve. Presumably, the requirement is intended to mean something more than that.

[ Summit: ]

> Move to open.

[ Beman has volunteered to provide proposed wording. ]

[ 2009-07-21 Beman added wording to address 33.2.2 [thread.req.exception] in response to the Frankfurt notes in 859. ]

[ 2009-09-25 Beman: minor update to wording. ]

[ 2009-10 Santa Cruz: ]

> Move to Ready.

Proposed resolution:

Change Exceptions 33.2.2 [thread.req.exception] as indicated:

> Some functions described in this Clause are specified to throw exceptions of type `system_error` (19.5.5). Such exceptions shall be thrown if any of the Error conditions are detected or a call to an operating system or other underlying API results in an error that prevents the library function from satisfying its postconditions or from returning a meaningful value meeting its specifications. Failure to allocate storage shall be reported as described in 16.4.6.13 [res.on.exception.handling].

Change thread assignment 33.4.3.6 [thread.thread.member], join(), paragraph 8 as indicated:

> Throws: `std::system_error` when the postconditions cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change thread assignment 33.4.3.6 [thread.thread.member], detach(), paragraph 13 as indicated:

> Throws: `std::system_error` when the effects or postconditions cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change Mutex requirements 33.6.4 [thread.mutex.requirements], paragraph 11, as indicated:

> Throws: `std::system_error` when the effects or postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change unique_lock locking 33.6.5.4.3 [thread.lock.unique.locking], paragraph 3, as indicated:

> Throws: `std::system_error` when the postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change unique_lock locking 33.6.5.4.3 [thread.lock.unique.locking], paragraph 8, as indicated:

> Throws: `std::system_error` when the postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change unique_lock locking 33.6.5.4.3 [thread.lock.unique.locking], paragraph 13, as indicated:

> Throws: `std::system_error` when the postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change unique_lock locking 33.6.5.4.3 [thread.lock.unique.locking], paragraph 18, as indicated:

> Throws: `std::system_error` when the postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change unique_lock locking 33.6.5.4.3 [thread.lock.unique.locking], paragraph 22, as indicated:

> Throws: `std::system_error` when the postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change Function call_once 33.6.7.2 [thread.once.callonce], paragraph 4, as indicated

> Throws: `std::system_error` when the effects cannot be achieved an exception is required (33.2.2 [thread.req.exception]), or any exception thrown by `func`.

Change Class condition_variable 33.7.4 [thread.condition.condvar], paragraph 12, as indicated:

> Throws: `std::system_error` when the effects or postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change Class condition_variable 33.7.4 [thread.condition.condvar], paragraph 19, as indicated:

> Throws: `std::system_error` when the effects or postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change Class condition_variable_any 33.7.5 [thread.condition.condvarany], paragraph 10, as indicated:

> Throws: `std::system_error` when the effects or postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Change Class condition_variable_any 33.7.5 [thread.condition.condvarany], paragraph 16, as indicated:

> Throws: `std::system_error` when the returned value, effects, or postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Assuming issue 859, Monotonic Clock is Conditionally Supported?, has been applied to the working paper, change Change 33.7.4 [thread.condition.condvar] as indicated:

>     template <class Rep, class Period>
>     bool wait_for(unique_lock<mutex>& lock,
>                   const chrono::duration<Rep, Period>& rel_time);

>     ...

> Throws: `std::system_error` when the effects or postcondition cannot be achieved an exception is required ([thread.req.exception]).

Assuming issue 859, Monotonic Clock is Conditionally Supported?, has been applied to the working paper, change Change 33.7.4 [thread.condition.condvar] as indicated:

>     template <class Rep, class Period, class Predicate>
>       bool wait_for(unique_lock<mutex>& lock,
>                     const chrono::duration<Rep, Period>& rel_time,
>                     Predicate pred);

>     ...

> Throws: `std::system_error` when the effects or postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Assuming issue 859, Monotonic Clock is Conditionally Supported?, has been applied to the working paper, change 33.7.5 [thread.condition.condvarany] as indicated:

>     template <class Lock, class Rep, class Period>
>       bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);

>     ...

> Throws: `std::system_error` when the returned value, effects or postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).

Assuming issue 859, Monotonic Clock is Conditionally Supported?, has been applied to the working paper, change 33.7.5 [thread.condition.condvarany] as indicated:

>     template <class Lock, class Rep, class Period, class Predicate>
>       bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);

>     ...

> Throws: `std::system_error` when the returned value, effects or postcondition cannot be achieved an exception is required (33.2.2 [thread.req.exception]).