Atomic waiting function calls should only be unblocked once
Geoffrey Romer

Created on 2019-08-19.00:00:00 last changed 9 months ago


Date: 2019-09-15.10:35:38

Proposed resolution:

This wording is relative to N4830.

  1. Modify [atomics.wait] as indicated:

    -?- All blocking and unblocking events on a single atomic object occur in a single total order that is consistent with the "happens before" partial order.

    -4- A call to an atomic waiting operation on an atomic object M is eligible to be unblocked by a call to an atomic notifying operation on M if it has not been unblocked, and there exist side effects X and Y on M such that:

    1. (4.1) — the atomic waiting operation has blocked after observing the result of X,

    2. (4.2) — X precedes Y in the modification order of M, and

    3. (4.3) — Y happens before the call to the atomic notifying operation.

Date: 2019-09-14.00:00:00

[ 2019-09-14 Priority set to 3 based on reflector discussion ]

Date: 2019-08-19.00:00:00

It appears that in a conforming implementation, all but one wait() call on a given atomic object may block forever, regardless of any notify_one() calls, because in principle every notify_one() call could be considered to unblock the same single wait() call. Common sense suggests (and David Olsen confirms) that the intent is for each waiting function call to be (non-spuriously) unblocked by at most one notifying function call, but as far as I can tell the words never say that.

Date User Action Args
2019-09-15 10:35:38adminsetmessages: + msg10617
2019-08-23 17:30:17adminsetmessages: + msg10582
2019-08-19 00:00:00admincreate