casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
dyscostman::threadgroup Class Reference

Group of threads. More...

#include <threadgroup.h>

Public Member Functions

 threadgroup ()
 Constructor. More...
 
 ~threadgroup ()
 Destructor. More...
 
template<typename T >
void create_thread (T threadFunc)
 Create a new thread that will execute the given functor. More...
 
void join_all ()
 Join all threads in the group that have not yet been joined. More...
 
bool empty () const
 Get state of thread group. More...
 

Private Attributes

std::vector< std::thread > _threads
 

Detailed Description

Group of threads.

Definition at line 13 of file threadgroup.h.

Constructor & Destructor Documentation

dyscostman::threadgroup::threadgroup ( )
inline

Constructor.

Definition at line 16 of file threadgroup.h.

dyscostman::threadgroup::~threadgroup ( )
inline

Destructor.

Will join all threads that have not been joined yet.

Definition at line 18 of file threadgroup.h.

References join_all().

Member Function Documentation

template<typename T >
void dyscostman::threadgroup::create_thread ( threadFunc)
inline

Create a new thread that will execute the given functor.

The new thread will be added to the group.

Parameters
threadFuncThe functor to be called.

Definition at line 26 of file threadgroup.h.

References _threads.

bool dyscostman::threadgroup::empty ( ) const
inline

Get state of thread group.

Returns
true when there are unjoined threads in the group. Not synchronized – caller has to make sure that thread is safe.

Definition at line 45 of file threadgroup.h.

References _threads.

void dyscostman::threadgroup::join_all ( )
inline

Join all threads in the group that have not yet been joined.

Definition at line 33 of file threadgroup.h.

References _threads.

Referenced by ~threadgroup().

Member Data Documentation

std::vector<std::thread> dyscostman::threadgroup::_threads
private

Definition at line 48 of file threadgroup.h.

Referenced by create_thread(), empty(), and join_all().


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