table of contents
- testing 12.2.0-14
- unstable 12.2.0-14
- experimental 12.3.0-1
using id = thread::id
using native_handle_type = thread::native_handle_type
Public Member Functions¶
template<typename _Callable , typename... _Args, typename =
jthread>>> jthread (_Callable &&__f, _Args
jthread (const jthread &)=delete
jthread (jthread &&) noexcept=default
void detach ()
id get_id () const noexcept
stop_source get_stop_source () noexcept
stop_token get_stop_token () const noexcept
void join ()
bool joinable () const noexcept
native_handle_type native_handle ()
jthread & operator= (const jthread &)=delete
jthread & operator= (jthread &&__other) noexcept
bool request_stop () noexcept
void swap (jthread &__other) noexcept
Static Public Member Functions¶
static unsigned hardware_concurrency () noexcept
void swap (jthread &__lhs, jthread
A thread with cancellation and automatic joining.
Unlike std::thread, destroying a joinable std::jthread will not terminate the process. Instead, it will try to request its thread to stop, then will join it.
A std::jthread has a std::stop_source member which will be passed as the first argument to the callable that runs in the new thread (as long as the callable will accept that argument). That can then be used to send a stop request that the new thread can test for.
Generated automatically by Doxygen for libstdc++ from the source code.
|Wed May 10 2023||libstdc++|