.TH "std::jthread" 3cxx "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::jthread .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Types" .in +1c .ti -1c .RI "\fBusing\fP \fBid\fP = \fBthread::id\fP" .br .ti -1c .RI "\fBusing\fP \fBnative_handle_type\fP = thread::native_handle_type" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "template<\fBtypename\fP _Callable , typename\&.\&.\&. _Args, \fBtypename\fP = enable_if_t, jthread>>> \fBjthread\fP (_Callable &&__f, \fB_Args\fP &&\&.\&.\&. \fB__args\fP)" .br .ti -1c .RI "\fBjthread\fP (const \fBjthread\fP &)=\fBdelete\fP" .br .ti -1c .RI "\fBjthread\fP (\fBjthread\fP &&) noexcept=\fBdefault\fP" .br .ti -1c .RI "\fBvoid\fP \fBdetach\fP ()" .br .ti -1c .RI "\fBid\fP \fBget_id\fP () const noexcept" .br .ti -1c .RI "\fBstop_source\fP \fBget_stop_source\fP () noexcept" .br .ti -1c .RI "\fBstop_token\fP \fBget_stop_token\fP () const noexcept" .br .ti -1c .RI "\fBvoid\fP \fBjoin\fP ()" .br .ti -1c .RI "bool \fBjoinable\fP () const noexcept" .br .ti -1c .RI "native_handle_type \fBnative_handle\fP ()" .br .ti -1c .RI "\fBjthread\fP & \fBoperator=\fP (const \fBjthread\fP &)=\fBdelete\fP" .br .ti -1c .RI "\fBjthread\fP & \fBoperator=\fP (\fBjthread\fP &&__other) noexcept" .br .ti -1c .RI "bool \fBrequest_stop\fP () noexcept" .br .ti -1c .RI "\fBvoid\fP \fBswap\fP (\fBjthread\fP &__other) noexcept" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "\fBstatic\fP unsigned \fBhardware_concurrency\fP () noexcept" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "\fBvoid\fP \fBswap\fP (\fBjthread\fP &\fB__lhs\fP, \fBjthread\fP &\fB__rhs\fP) noexcept" .br .in -1c .SH "Detailed Description" .PP A thread with cancellation and automatic joining\&. .PP Unlike \fCstd::thread\fP, destroying a joinable \fCstd::jthread\fP will not terminate the process\&. Instead, it will try to request its thread to stop, then will join it\&. .PP A \fCstd::jthread\fP has a \fCstd::stop_source\fP 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\&. .PP \fBSince\fP .RS 4 C++20 .RE .PP .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.