thread_supervisor
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
tut::thread::Supervisor< t_Logger > Class Template Reference

Detailed Description

template<class t_Logger>
class tut::thread::Supervisor< t_Logger >

Thread supervisor.

Definition at line 338 of file supervisor.h.

#include <supervisor.h>

Inheritance diagram for tut::thread::Supervisor< t_Logger >:
t_Logger

Public Member Functions

 Supervisor ()
 
 ~Supervisor ()
 
void interrupt ()
 Interrupt execution, see isInterrupted. More...
 
bool isInterrupted () const
 Check if interrupted, child threads should stop when true (pass supervisor as a parameter). More...
 
bool stop (const std::size_t wait_ms=10000)
 Interrupt and wait for children to stop. More...
 
template<class... t_Args>
void add (t_Args &&...args)
 Add a thread: (<thread parameters>, <function pointer>, <function parameters>) More...
 

Protected Member Functions

bool wait (const std::size_t wait_ms)
 
bool empty ()
 
void drop (const std::list< Thread >::iterator &item)
 

Private Attributes

THREAD_SUPERVISOR_DISABLE_CLASS_COPY(Supervisor) protected std::mutex threads_mutex_
 
Thread::List threads_
 
std::mutex terminated_threads_mutex_
 
std::list< Thread::Reference > terminated_threads_
 

Friends

class Thread
 

Constructor & Destructor Documentation

◆ Supervisor()

template<class t_Logger >
tut::thread::Supervisor< t_Logger >::Supervisor ( )
inline

Definition at line 416 of file supervisor.h.

◆ ~Supervisor()

template<class t_Logger >
tut::thread::Supervisor< t_Logger >::~Supervisor ( )
inline

Definition at line 422 of file supervisor.h.

Member Function Documentation

◆ add()

template<class t_Logger >
template<class... t_Args>
void tut::thread::Supervisor< t_Logger >::add ( t_Args &&...  args)
inline

Add a thread: (<thread parameters>, <function pointer>, <function parameters>)

Definition at line 469 of file supervisor.h.

◆ drop()

template<class t_Logger >
void tut::thread::Supervisor< t_Logger >::drop ( const std::list< Thread >::iterator &  item)
inlineprotected

Definition at line 405 of file supervisor.h.

◆ empty()

template<class t_Logger >
bool tut::thread::Supervisor< t_Logger >::empty ( )
inlineprotected

Definition at line 398 of file supervisor.h.

◆ interrupt()

template<class t_Logger >
void tut::thread::Supervisor< t_Logger >::interrupt ( )
inline

Interrupt execution, see isInterrupted.

Definition at line 446 of file supervisor.h.

◆ isInterrupted()

template<class t_Logger >
bool tut::thread::Supervisor< t_Logger >::isInterrupted ( ) const
inline

Check if interrupted, child threads should stop when true (pass supervisor as a parameter).

Definition at line 453 of file supervisor.h.

◆ stop()

template<class t_Logger >
bool tut::thread::Supervisor< t_Logger >::stop ( const std::size_t  wait_ms = 10000)
inline

Interrupt and wait for children to stop.

Definition at line 460 of file supervisor.h.

◆ wait()

template<class t_Logger >
bool tut::thread::Supervisor< t_Logger >::wait ( const std::size_t  wait_ms)
inlineprotected

Definition at line 355 of file supervisor.h.

Friends And Related Function Documentation

◆ Thread

template<class t_Logger >
friend class Thread
friend

Definition at line 340 of file supervisor.h.

Member Data Documentation

◆ terminated_threads_

template<class t_Logger >
std::list<Thread::Reference> tut::thread::Supervisor< t_Logger >::terminated_threads_
private

Definition at line 351 of file supervisor.h.

◆ terminated_threads_mutex_

template<class t_Logger >
std::mutex tut::thread::Supervisor< t_Logger >::terminated_threads_mutex_
private

Definition at line 350 of file supervisor.h.

◆ threads_

template<class t_Logger >
Thread::List tut::thread::Supervisor< t_Logger >::threads_
private

Definition at line 348 of file supervisor.h.

◆ threads_mutex_

template<class t_Logger >
THREAD_SUPERVISOR_DISABLE_CLASS_COPY (Supervisor) protected std::mutex tut::thread::Supervisor< t_Logger >::threads_mutex_
private

Definition at line 347 of file supervisor.h.


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