Title
{shared,unique}_lock should use std::addressof
Status
c++17
Section
[thread.lock.unique.cons][thread.lock.shared.cons]
Submitter
Tim Song

Created on 2016-01-01.00:00:00 last changed 90 months ago

Messages

Date: 2016-02-07.20:24:45

Proposed resolution:

This wording is relative to N4567.

  1. Edit [thread.lock.unique.cons] as indicated:

    explicit unique_lock(mutex_type& m);
    

    […]

    -5- Postconditions: pm == &maddressof(m) and owns == true.

    unique_lock(mutex_type& m, defer_lock_t) noexcept;
    

    […]

    -7- Postconditions: pm == &maddressof(m) and owns == false.

    unique_lock(mutex_type& m, try_to_lock_t);
    

    […]

    -10- Postconditions: pm == &maddressof(m) and owns == res, where res is the value returned by the call to m.try_lock().

    unique_lock(mutex_type& m, adopt_lock_t);
    

    […]

    -13- Postconditions: pm == &maddressof(m) and owns == true.

    -14- Throws: Nothing.

    template <class Clock, class Duration>
      unique_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
    

    […]

    -17- Postconditions: pm == &maddressof(m) and owns == res, where res is the value returned by the call to m.try_lock_until(abs_time).

    template <class Rep, class Period>
      unique_lock(mutex_type& m, const chrono::duration<Rep, Period>& rel_time);
    

    […]

    -20- Postconditions: pm == &maddressof(m) and owns == res, where res is the value returned by the call to m.try_lock_for(rel_time).

  2. Edit [thread.lock.shared.cons] as indicated:

    explicit shared_lock(mutex_type& m);
    

    […]

    -5- Postconditions: pm == &maddressof(m) and owns == true.

    shared_lock(mutex_type& m, defer_lock_t) noexcept;
    

    […]

    -7- Postconditions: pm == &maddressof(m) and owns == false.

    shared_lock(mutex_type& m, try_to_lock_t);
    

    […]

    -10- Postconditions: pm == &maddressof(m) and owns == res where res is the value returned by the call to m.try_lock_shared().

    shared_lock(mutex_type& m, adopt_lock_t);
    

    […]

    -13- Postconditions: pm == &maddressof(m) and owns == true.

    template <class Clock, class Duration>
      shared_lock(mutex_type& m,
                  const chrono::time_point<Clock, Duration>& abs_time);
    

    […]

    -16- Postconditions: pm == &maddressof(m) and owns == res where res is the value returned by the call to m.try_lock_shared_until(abs_time).

    template <class Rep, class Period>
      shared_lock(mutex_type& m,
                  const chrono::duration<Rep, Period>& rel_time);
    

    […]

    -19- Postconditions: pm == &maddressof(m) and owns == res where res is the value returned by the call to m.try_lock_shared_for(rel_time).

Date: 2016-02-07.20:24:45

[ 2016-02, Issues Telecon ]

P0; move to Tentatively Ready.

Date: 2016-01-01.00:00:00

So that they work with user-defined types that have overloaded unary &.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-03-07 04:11:48adminsetstatus: ready -> wp
2016-02-07 20:24:45adminsetmessages: + msg7967
2016-02-07 20:24:45adminsetstatus: new -> ready
2016-01-14 19:30:46adminsetmessages: + msg7672
2016-01-01 00:00:00admincreate