[patch] Define std::promise::set_value_at_thread_exit() etc.
Jonathan Wakely
jwakely@redhat.com
Thu Oct 23 16:00:00 GMT 2014
This adds:
std::notify_all_at_thread_exit()
std::promise<>::set_value_at_thread_exit()
std::promise<>::set_exception_at_thread_exit()
std::packaged_task<>::make_ready_at_thread_exit()
There's a linked list of callbacks that run after TLS destructors
(called by a pthread_key_create destructor) to make shared states
ready and notify condition variables.
The core of the change to futures is that the shared state is
considered ready when _M_ready == true, instead of when _M_result !=
nullptr, so that we can store a result in _M_result without making it
ready. The callback that would make it ready at thread exit stores a
weak_ptr so it can safely check whether the shared state has already
been destroyed before thread exit (see thread c++std-parallel-1162 on
the SG1 list for related discussion).
Tested x86_64-linux, I'd like to commit this next week some time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 19889 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20141023/32c0e538/attachment.bin>
More information about the Libstdc++
mailing list