You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could SG1 please take a look and confirm that they're happy for us to strike the explicit "Abandons/Releases the shared state" wording from both promise::operator= and packaged_task::operator=.
Technically, the current wording requires abandoning/releasing the state first, before transferring creating the temporary and swapping. After this change, the state will be implicitly abandoned by the temporary's destructor. The difference is observable for packaged_task, because another thread can observe whether the shared state is made ready before or after the stored task is moved to a new packaged_task. However, none of the major std::lib impls actually do it that way, so users aren't getting the order currently specified in the standard anyway.
So this simplifies the spec of promise, and simplifies and fixes the broken spec of packaged_task which previously failed to make the state ready by abandoning it. In both cases the proposed change makes the move-assignment operators safe for self-assignment, so that p = std::move(p) becomes a no-op instead of needlessly abandoning the state and leaving p empty.
The text was updated successfully, but these errors were encountered:
https://cplusplus.github.io/LWG/issue4158
Could SG1 please take a look and confirm that they're happy for us to strike the explicit "Abandons/Releases the shared state" wording from both
promise::operator=
andpackaged_task::operator=
.Technically, the current wording requires abandoning/releasing the state first, before transferring creating the temporary and swapping. After this change, the state will be implicitly abandoned by the temporary's destructor. The difference is observable for
packaged_task
, because another thread can observe whether the shared state is made ready before or after the stored task is moved to a newpackaged_task
. However, none of the major std::lib impls actually do it that way, so users aren't getting the order currently specified in the standard anyway.So this simplifies the spec of
promise
, and simplifies and fixes the broken spec ofpackaged_task
which previously failed to make the state ready by abandoning it. In both cases the proposed change makes the move-assignment operators safe for self-assignment, so thatp = std::move(p)
becomes a no-op instead of needlessly abandoning the state and leavingp
empty.The text was updated successfully, but these errors were encountered: