.TH "std::thread" 3cxx "Tue Jun 13 2023" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::thread .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Classes" .in +1c .ti -1c .RI "class \fBid\fP" .br .in -1c .SS "Public Types" .in +1c .ti -1c .RI "using \fB_State_ptr\fP = \fBunique_ptr\fP< _State >" .br .ti -1c .RI "using \fBnative_handle_type\fP = __gthread_t" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "template>> \fBthread\fP (_Callable &&__f, _Args &&\&.\&.\&. __args)" .br .ti -1c .RI "\fBthread\fP (const \fBthread\fP &)=delete" .br .ti -1c .RI "\fBthread\fP (\fBthread\fP &&__t) noexcept" .br .ti -1c .RI "void \fBdetach\fP ()" .br .ti -1c .RI "\fBid\fP \fBget_id\fP () const noexcept" .br .ti -1c .RI "void \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 "\fBthread\fP & \fBoperator=\fP (const \fBthread\fP &)=delete" .br .ti -1c .RI "\fBthread\fP & \fBoperator=\fP (\fBthread\fP &&__t) noexcept" .br .ti -1c .RI "void \fBswap\fP (\fBthread\fP &__t) noexcept" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static unsigned int \fBhardware_concurrency\fP () noexcept" .br .in -1c .SS "Related Functions" (Note that these are not member functions\&.) .in +1c .ti -1c .RI "void \fBswap\fP (\fBthread\fP &__x, \fBthread\fP &__y) noexcept" .br .in -1c .SH "Detailed Description" .PP A std::thread represents a new thread of execution\&. .PP The default constructor creates an object that does not own a thread\&. The \fCthread(F&&, Args&&\&.\&.\&.)\fP constructor invokes a callable in a new thread, and owns that new thread\&. A \fCstd::thread\fP that owns a thread is \fIjoinable\fP\&. Joining a thread waits for it to finish executing, which happens when the callable running in that thread returns\&. .PP A \fCstd::thread\fP cannot be copied, but can be moved\&. Moving a joinable object transfers ownership of its thread to another object\&. .PP A joinable \fCstd::thread\fP must be explicitly joined (or detached) before it is destroyed or assigned to\&. Attempting to destroy a joinable thread will terminate the whole process\&. .PP \fBSince\fP .RS 4 C++11 .RE .PP .SH "Member Function Documentation" .PP .SS "native_handle_type std::thread::native_handle ()\fC [inline]\fP" .PP \fBPrecondition\fP .RS 4 thread is joinable .RE .PP .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.