diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-11-15 23:44:47 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-11-15 23:44:47 +0000 |
commit | e73ca078b8d9de25593006ae573b48ae6b12576c (patch) | |
tree | 40a58633577e8773f091cf2c351fbaacc9b42cf9 /gcc | |
parent | d5fbe5e014bc9fc803604eec805392c21ff4da16 (diff) | |
download | gcc-e73ca078b8d9de25593006ae573b48ae6b12576c.zip gcc-e73ca078b8d9de25593006ae573b48ae6b12576c.tar.gz gcc-e73ca078b8d9de25593006ae573b48ae6b12576c.tar.bz2 |
libstdc++: Fix <stop_token> and improve tests
* include/std/stop_token: Reduce header dependencies by including
internal headers.
(stop_token::swap(stop_token&), swap(stop_token&, stop_token&)):
Define.
(operator!=(const stop_token&, const stop_token&)): Fix return value.
(stop_token::_Stop_cb::_Stop_cb(Cb&&)): Use std::forward instead of
(stop_token::_Stop_state_t) [_GLIBCXX_HAS_GTHREADS]: Use lock_guard
instead of unique_lock.
[!_GLIBCXX_HAS_GTHREADS]: Do not use mutex.
(stop_token::stop_token(_Stop_state)): Change parameter to lvalue
reference.
(stop_source): Remove unnecessary using-declarations for names only
used once.
(swap(stop_source&, stop_source&)): Define.
(stop_callback(const stop_token&, _Cb&&))
(stop_callback(stop_token&&, _Cb&&)): Replace lambdas with a named
function. Use std::forward instead of std::move. Run callbacks if a
stop request has already been made.
(stop_source::_M_execute()): Remove.
(stop_source::_S_execute(_Stop_cb*)): Define.
* include/std/version (__cpp_lib_jthread): Define conditionally.
* testsuite/30_threads/stop_token/stop_callback.cc: New test.
* testsuite/30_threads/stop_token/stop_source.cc: New test.
* testsuite/30_threads/stop_token/stop_token.cc: Enable test for
immediate execution of callback.
From-SVN: r278325
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions