Namespaces
Variants
Views
Actions

Talk:cpp/thread/promise/get future

From cppreference.com
< Talk:cpp‎ | thread‎ | promise

[edit] Unclear text

The text reads (highlights are mine):

Calls to this function do not introduce data races with calls to set_value, set_exception, set_value_at_thread_exit, or set_exception_at_thread_exit (but they need not synchronize with each other).


Shouldn't it be:

Calls to this function do not introduce data races with calls to set_value, set_exception, set_value_at_thread_exit, or set_exception_at_thread_exit (therefore they need not synchronize with each other).

ticotico (talk)

"therefore" is correct, IMO.)
The draft says
   The set_­value, set_­exception, set_­value_­at_­thread_­exit, and set_­exception_­at_­thread_­exit member functions
   behave as though they acquire a single mutex associated with the promise object while updating the promise
   object.
and also
   future<R> get_future();
   Synchronization: Calls to this function do not introduce data races ([intro.multithread]) with calls to
   set_value, set_­exception, set_­value_­at_­thread_­exit, or set_­exception_­at_­thread_­exit.
   [Note 1: Such calls need not synchronize with each other. — end note]
--Space Mission (talk) 09:21, 26 August 2021 (PDT)