C++ Logo


Advanced search

Re: Synchronization of atomic notify and wait

From: language.lawyer_at <language.lawyer_at_[hidden]>
Date: Tue, 19 Jul 2022 16:09:12 +0500
On 19/07/2022 16:00, Marcin Jaczewski wrote:
> wt., 19 lip 2022 o 12:51 <language.lawyer_at_[hidden]> napisaƂ(a):
>> On 19/07/2022 15:43, Marcin Jaczewski wrote:
>>> it's not term but definition that is used further:
>> It *is* a term which *has* a definition.
>>> "Effects: Unblocks the execution of at least one atomic waiting
>>> operation on *ptr that is eligible to be unblocked ([atomics.wait]) by
>>> this call, if any such atomic waiting operations exist."
>>> And now its requirement.
>> I don't get how the use of a term makes it (its definition?) a requirement.
>> BTW, you might have noticed that I've rewritten std::atomic::notify_one /Effects/ using new term /hairy/. std::atomic_ref::notify_one can be changed similarly.
> Even if you name it X it still holds, "if something is in state X,
> then will be unblocked". Was `wait` in state X?
> In previous messages it was clearly show that `wait` was in state X
> and by specyficacton of `notify` it should be unblock.

There are no doubts that the waiting thread will unblock in https://timsong-cpp.github.io/cppwp/n4861/atomics.types.operations#30.3
There are doubts that it is guaranteed to see the new value in https://timsong-cpp.github.io/cppwp/n4861/atomics.types.operations#30.1

No, you can't squeeze this guarantee out of the exact textual representation of the term. Neither from its color, weight, smell, taste etc.

Received on 2022-07-19 11:09:17