libstdc++
std::jthread Class Reference

Public Types

using id = thread::id
 
using native_handle_type = thread::native_handle_type
 

Public Member Functions

template<typename _Callable , typename... _Args, typename = enable_if_t<!is_same_v<remove_cvref_t<_Callable>, jthread>>>
 jthread (_Callable &&__f, _Args &&... __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 ()
 
jthreadoperator= (const jthread &)=delete
 
jthreadoperator= (jthread &&__other) noexcept
 
bool request_stop () noexcept
 
void swap (jthread &__other) noexcept
 

Static Public Member Functions

static unsigned hardware_concurrency () noexcept
 

Friends

void swap (jthread &__lhs, jthread &__rhs) noexcept
 

Detailed Description

A thread that can be requested to stop and automatically joined.

Definition at line 113 of file thread.

Member Typedef Documentation

◆ id

Definition at line 116 of file thread.

◆ native_handle_type

using std::jthread::native_handle_type = thread::native_handle_type

Definition at line 117 of file thread.

Constructor & Destructor Documentation

◆ jthread() [1/2]

std::jthread::jthread ( )
inlinenoexcept

Definition at line 119 of file thread.

◆ jthread() [2/2]

template<typename _Callable , typename... _Args, typename = enable_if_t<!is_same_v<remove_cvref_t<_Callable>, jthread>>>
std::jthread::jthread ( _Callable &&  __f,
_Args &&...  __args 
)
inlineexplicit

Definition at line 127 of file thread.

◆ ~jthread()

std::jthread::~jthread ( )
inline

Definition at line 135 of file thread.

Member Function Documentation

◆ detach()

void std::jthread::detach ( )
inline

Definition at line 174 of file thread.

◆ get_id()

id std::jthread::get_id ( ) const
inlinenoexcept

Definition at line 180 of file thread.

◆ get_stop_source()

stop_source std::jthread::get_stop_source ( )
inlinenoexcept

Definition at line 198 of file thread.

◆ get_stop_token()

stop_token std::jthread::get_stop_token ( ) const
inlinenoexcept

Definition at line 204 of file thread.

◆ hardware_concurrency()

static unsigned std::jthread::hardware_concurrency ( )
inlinestaticnoexcept

Definition at line 192 of file thread.

◆ join()

void std::jthread::join ( )
inline

Definition at line 168 of file thread.

◆ joinable()

bool std::jthread::joinable ( ) const
inlinenoexcept

Definition at line 162 of file thread.

◆ native_handle()

native_handle_type std::jthread::native_handle ( )
inline

Definition at line 186 of file thread.

◆ operator=()

jthread & std::jthread::operator= ( jthread &&  __other)
inlinenoexcept

Definition at line 148 of file thread.

◆ request_stop()

bool std::jthread::request_stop ( )
inlinenoexcept

Definition at line 209 of file thread.

◆ swap()

void std::jthread::swap ( jthread __other)
inlinenoexcept

Definition at line 155 of file thread.

Friends And Related Function Documentation

◆ swap

void swap ( jthread __lhs,
jthread __rhs 
)
friend

Definition at line 214 of file thread.


The documentation for this class was generated from the following file: