ORIGINAL
Loading...
Searching...
No Matches
original::thread Class Reference

High-level thread wrapper. More...

#include <thread.h>

Collaboration diagram for original::thread:
Collaboration graph

Public Member Functions

 thread ()
 Construct empty thread.
 
template<typename Callback, typename... ARGS>
 thread (Callback c, ARGS &&... args)
 Construct and start thread with callback.
 
template<typename Callback, typename... ARGS>
 thread (Callback c, bool will_join, ARGS &&... args)
 Construct and start thread with callback and join policy.
 
 thread (pThread p_thread, bool will_join=true)
 Construct from existing pThread.
 
 thread (const thread &)=delete
 
threadoperator= (const thread &)=delete
 
 thread (thread &&other) noexcept
 Move constructor.
 
 thread (thread &&other, bool will_join) noexcept
 Move constructor with explicit join policy.
 
threadoperator= (thread &&other) noexcept
 
bool joinable () const
 Check if thread is joinable.
 
 operator bool () const
 Check if thread is valid.
 
bool operator! () const
 Check if thread is not valid.
 
void join ()
 Wait for thread to complete.
 
void detach ()
 Detach thread (allow it to run independently)
 
 ~thread ()
 Destructor.
 

Detailed Description

High-level thread wrapper.

Manages thread lifetime with automatic join/detach

Constructor & Destructor Documentation

◆ thread() [1/5]

template<typename Callback, typename ... ARGS>
original::thread::thread ( Callback c,
ARGS &&... args )
explicit

Construct and start thread with callback.

Template Parameters
CallbackCallback function type
ARGSArgument types for callback
Parameters
cCallback function
argsArguments to forward to callback
Note
Will automatically join on destruction

◆ thread() [2/5]

template<typename Callback, typename ... ARGS>
original::thread::thread ( Callback c,
bool will_join,
ARGS &&... args )
explicit

Construct and start thread with callback and join policy.

Template Parameters
CallbackCallback function type
ARGSArgument types for callback
Parameters
cCallback function
will_joinWhether to join on destruction
argsArguments to forward to callback

◆ thread() [3/5]

original::thread::thread ( pThread p_thread,
bool will_join = true )
inlineexplicit

Construct from existing pThread.

Parameters
p_threadThread to wrap
will_joinWhether to join on destruction

◆ thread() [4/5]

original::thread::thread ( thread && other)
inlinenoexcept

Move constructor.

Parameters
otherThread to move from
Note
Defaults to join policy of source thread

◆ thread() [5/5]

original::thread::thread ( thread && other,
bool will_join )
inlinenoexcept

Move constructor with explicit join policy.

Parameters
otherThread to move from
will_joinOverride join policy

◆ ~thread()

original::thread::~thread ( )
inline

Destructor.

Note
Automatically joins or detaches based on will_join policy

Member Function Documentation

◆ detach()

void original::thread::detach ( )
inline

Detach thread (allow it to run independently)

Exceptions
sysErrorif detach fails

◆ join()

void original::thread::join ( )
inline

Wait for thread to complete.

Exceptions
sysErrorif join fails

◆ joinable()

bool original::thread::joinable ( ) const
nodiscard

Check if thread is joinable.

Returns
true if thread is joinable

◆ operator bool()

original::thread::operator bool ( ) const
explicit

Check if thread is valid.

Returns
true if thread is valid

◆ operator!()

bool original::thread::operator! ( ) const

Check if thread is not valid.

Returns
true if thread is not valid

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