[PATCH] Add support for C++2a stop_token
Jonathan Wakely
jwakely@redhat.com
Fri Nov 15 14:38:00 GMT 2019
On 13/11/19 17:59 -0800, Thomas Rodgers wrote:
>+ // TODO verify the standard requires this
>+#if 0
>+ // register another callback
>+ bool cb3called{false};
>+ std::stop_callback scb3{stok, [&]
>+ {
>+ cb3called = true;
>+ }};
>+ VERIFY(ssrc.stop_possible());
>+ VERIFY(ssrc.stop_requested());
>+ VERIFY(stok.stop_possible());
>+ VERIFY(stok.stop_requested());
>+ VERIFY(!cb1called);
>+ VERIFY(cb2called);
>+ VERIFY(cb3called);
>+#endif
The working draft definitely requires this:
Effects: Initializes callback with std::forward<C>(cb). If st.stop_requested() is true, then
std::forward<Callback>(callback)() is evaluated in the current thread before the constructor
returns.
More information about the Libstdc++
mailing list