roo_threads
API Documentation for roo_threads
Loading...
Searching...
No Matches
roo_threads::doc::thread Class Reference

Canonical documentation-only thread API. More...

#include <thread_api.h>

Data Structures

class  attributes
 Optional thread attributes used by backend-specific constructors. More...
 
class  id
 

Public Member Functions

 thread () noexcept
 Constructs a non-joinable empty thread handle.
 
 thread (const thread &)=delete
 
 thread (thread &&other) noexcept
 Move-constructs a thread handle.
 
template<typename Callable , typename... Args>
 thread (Callable &&callable, Args &&... args)
 Starts a new thread using default attributes.
 
template<typename Callable , typename... Args>
 thread (const attributes &attrs, Callable &&callable, Args &&... args)
 Starts a new thread using explicit attributes.
 
 ~thread ()
 Destroys the thread handle.
 
threadoperator= (const thread &)=delete
 
threadoperator= (thread &&other) noexcept
 Move-assigns a thread handle.
 
void swap (thread &other) noexcept
 Swaps two thread handles.
 
bool joinable () const noexcept
 Returns true if this handle represents an active thread.
 
void join ()
 Waits for the represented thread to complete.
 
void detach ()
 Detaches the represented thread from this handle.
 
id get_id () const noexcept
 Returns identifier of the represented thread.
 

Detailed Description

Canonical documentation-only thread API.

This type exists only to provide a single source of truth for API docs across backend-specific implementations selected via compile-time macros.

Definition at line 15 of file thread_api.h.

Constructor & Destructor Documentation

◆ thread() [1/5]

roo_threads::doc::thread::thread ( )
noexcept

Constructs a non-joinable empty thread handle.

◆ thread() [2/5]

roo_threads::doc::thread::thread ( const thread )
delete

◆ thread() [3/5]

roo_threads::doc::thread::thread ( thread &&  other)
noexcept

Move-constructs a thread handle.

Parameters
othersource thread handle.

◆ thread() [4/5]

template<typename Callable , typename... Args>
roo_threads::doc::thread::thread ( Callable &&  callable,
Args &&...  args 
)
explicit

Starts a new thread using default attributes.

Template Parameters
Callablecallable type.
Argsargument types.
Parameters
callablecallable object.
argsarguments passed to callable.

◆ thread() [5/5]

template<typename Callable , typename... Args>
roo_threads::doc::thread::thread ( const attributes attrs,
Callable &&  callable,
Args &&...  args 
)
explicit

Starts a new thread using explicit attributes.

Template Parameters
Callablecallable type.
Argsargument types.
Parameters
attrsbackend-specific thread attributes.
callablecallable object.
argsarguments passed to callable.

◆ ~thread()

roo_threads::doc::thread::~thread ( )

Destroys the thread handle.

Backend-specific behavior applies if the thread is still joinable.

Member Function Documentation

◆ detach()

void roo_threads::doc::thread::detach ( )

Detaches the represented thread from this handle.

◆ get_id()

id roo_threads::doc::thread::get_id ( ) const
noexcept

Returns identifier of the represented thread.

◆ join()

void roo_threads::doc::thread::join ( )

Waits for the represented thread to complete.

◆ joinable()

bool roo_threads::doc::thread::joinable ( ) const
noexcept

Returns true if this handle represents an active thread.

◆ operator=() [1/2]

thread & roo_threads::doc::thread::operator= ( const thread )
delete

◆ operator=() [2/2]

thread & roo_threads::doc::thread::operator= ( thread &&  other)
noexcept

Move-assigns a thread handle.

Parameters
othersource thread handle.
Returns
reference to this object.

◆ swap()

void roo_threads::doc::thread::swap ( thread other)
noexcept

Swaps two thread handles.

Parameters
otherthread handle to swap with.

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