std::jthread::operator=(std::jthread&&) calls std::terminate if *this has an associated running thread.

Ville Voutilainen ville.voutilainen@gmail.com
Fri Nov 6 21:35:06 GMT 2020


On Fri, 6 Nov 2020 at 23:14, Paul Scharnofske via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>      +          // The C++ Standard (working draft) says that this
> method must be
>      +          // noexcept, but also dictates that join be called. It
> doesn't say
>      +          // how to do this, this is probably the way to go?
>      +          try
>      +            {
>      +              join();
>      +            }
>      +          catch (...)
>      +            {
>      +              std::terminate();
>      +            }
>      +        }

Just calling join() will have the same effect, without having to
bother with the additional catching.


More information about the Libstdc++ mailing list