]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Assigning to a joinable std::jthread calls std::terminate
authorPaul Scharnofske <asynts@gmail.com>
Wed, 11 Nov 2020 09:29:37 +0000 (09:29 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 11 Nov 2020 11:17:12 +0000 (11:17 +0000)
commit7c44b67d83b34e56a4f65afd70754c5e30280247
treecb7e06fea3f189194ce82fd535a4c19f5d9bc2b8
parentf7c2be50afa7935d3a05e3c7761e69d8b539da5b
libstdc++: Assigning to a joinable std::jthread calls std::terminate

Move assigning to a std::jthread that represents a thread of execution
needs to send a stop request and join that running thread. Otherwise the
std::thread data member will terminate in its assignment operator.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/std/thread (jthread::operator=(jthread&&)): Transfer
any existing state to a temporary that will request a stop and
then join.
* testsuite/30_threads/jthread/jthread.cc: Test move assignment.

(cherry picked from commit 0ebaea3b6677ef8edfa5638800304db1a4f7c2f8)
libstdc++-v3/include/std/thread
libstdc++-v3/testsuite/30_threads/jthread/jthread.cc
This page took 0.066314 seconds and 6 git commands to generate.