Title
Misplaced effect in m.try_lock_for()
Status
c++14
Section
[thread.timedmutex.requirements]
Submitter
Pete Becker

Created on 2011-10-18.00:00:00 last changed 122 months ago

Messages

Date: 2013-04-19.22:22:17

Proposed resolution:

This wording is relative to N3337.

  1. Change [thread.timedmutex.requirements]/4 as indicated:

    -3- The expression m.try_lock_for(rel_time) shall be well-formed and have the following semantics:

    -4- Requires: If the tick period of rel_time is not exactly convertible to the native tick period, the duration shall be rounded up to the nearest native tick period. If m is of type std::timed_mutex, the calling thread does not own the mutex.

Date: 2013-04-20.00:00:00

[ 2013-04-20 Bristol ]

Date: 2012-10-19.07:50:57

[ 2012, Portland ]

Concurrency move to Ready.

Date: 2012-02-13.21:55:45

[ 2012, Kona ]

Remove the offending sentence from the requirements clause. Do not add it back anywhere else. The implementation already must have license to wake up late, so the rounding is invisible.

Move to Review.

Date: 2011-10-18.00:00:00

[thread.timedmutex.requirements]/4 says, in part,

"Requires: If the tick period of [the argument] is not exactly convertible … [it] shall be rounded up …"

This doesn't belong in the requires clause. It's an effect. It belongs in paragraph 5. Nitpickingly, this would be a technical change: as written it imposes an obligation on the caller, while moving it imposes an obligation on the callee. Although that's certainly not what was intended.

Peter Dimov comments:

Not to mention that it should round down, not up. :-)

Incidentally, I see that the wrong try_lock requirement that the caller shall not own the mutex has entered the standard, after all. Oh well. Let's hope that the real world continues to ignore it.

History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2013-04-25 19:07:07adminsetstatus: voting -> wp
2013-04-19 22:22:17adminsetmessages: + msg6470
2013-04-19 22:22:17adminsetstatus: ready -> voting
2012-10-19 07:50:57adminsetmessages: + msg6181
2012-10-19 07:50:57adminsetstatus: review -> ready
2012-02-13 21:55:45adminsetmessages: + msg6014
2012-02-13 21:55:45adminsetmessages: + msg6013
2012-02-13 21:55:45adminsetstatus: new -> review
2011-10-18 00:00:00admincreate