join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::Thread Class Reference

thread class. More...

#include <thread.hpp>

Public Member Functions

 Thread () noexcept=default
 default constructor.
 
template<class Function , class... Args>
 Thread (Function &&func, Args &&... args)
 creates a new thread object associated with a thread of execution.
 
 Thread (const Thread &other)=delete
 copy constructor.
 
Threadoperator= (const Thread &other)=delete
 copy assignment.
 
 Thread (Thread &&other) noexcept
 move constructor.
 
Threadoperator= (Thread &&other) noexcept
 move assignment.
 
 ~Thread ()
 destroys the thread object.
 
bool joinable () const noexcept
 check if thread is joinable.
 
bool running () const noexcept
 check if the thread is running.
 
void join ()
 block the current thread until the running thread finishes its execution.
 
bool tryJoin ()
 performs a nonblocking join on the running thread.
 
void cancel ()
 cancel the running thread if any.
 
void swap (Thread &other)
 swap underlying handles of two thread objects.
 

Detailed Description

thread class.

Constructor & Destructor Documentation

◆ Thread() [1/4]

join::Thread::Thread ( )
defaultnoexcept

default constructor.

◆ Thread() [2/4]

template<class Function , class... Args>
join::Thread::Thread ( Function && func,
Args &&... args )
inlineexplicit

creates a new thread object associated with a thread of execution.

Parameters
funccallable object to execute in the new thread.
args...arguments to pass to the new function.

◆ Thread() [3/4]

join::Thread::Thread ( const Thread & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ Thread() [4/4]

Thread::Thread ( Thread && other)
noexcept

move constructor.

Parameters
otherother object to move.

◆ ~Thread()

Thread::~Thread ( )

destroys the thread object.

Member Function Documentation

◆ cancel()

void Thread::cancel ( )

cancel the running thread if any.

◆ join()

void Thread::join ( )

block the current thread until the running thread finishes its execution.

◆ joinable()

bool Thread::joinable ( ) const
noexcept

check if thread is joinable.

Returns
true if joinable.

◆ operator=() [1/2]

Thread & join::Thread::operator= ( const Thread & other)
delete

copy assignment.

Parameters
otherother object to copy.
Returns
a reference to the current object.

◆ operator=() [2/2]

Thread & Thread::operator= ( Thread && other)
noexcept

move assignment.

Parameters
otherother object to move.
Returns
a reference to the current object.

◆ running()

bool Thread::running ( ) const
noexcept

check if the thread is running.

Returns
true if running, false otherwise.

◆ swap()

void Thread::swap ( Thread & other)

swap underlying handles of two thread objects.

Parameters
otherthe thread to swap with.

◆ tryJoin()

bool Thread::tryJoin ( )

performs a nonblocking join on the running thread.

Returns
true if thread was joined, false if running thread didn't finished its execution.

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