Thea
Public Member Functions | List of all members
ThreadGroup Class Reference

Manages a group of threads and allows waiting for all of them to finish. More...

#include <ThreadGroup.hpp>

Public Member Functions

void addThread (std::thread *thrd)
 Add an existing thread to the group. More...
 
bool containsThisThread () const
 Check if the group contains the current thread. More...
 
bool containsThread (std::thread *thrd) const
 Check if the group contains a particular thread. More...
 
template<typename F >
std::thread * createThread (F thread_func)
 Create a thread wrapping a functor and add it to the group. More...
 
void joinAll ()
 Wait for all threads to finish. More...
 
void removeThread (std::thread *thrd)
 Remove a thread from the group. More...
 
 ThreadGroup ()
 Default constructor. More...
 
 ~ThreadGroup ()
 Destructor. More...
 

Detailed Description

Manages a group of threads and allows waiting for all of them to finish.

Exists because boost::thread_group did not make it to C++11. Lifted straight from the Boost source code (1.67.0).

Definition at line 62 of file ThreadGroup.hpp.

Constructor & Destructor Documentation

Default constructor.

Definition at line 73 of file ThreadGroup.hpp.

Destructor.

Definition at line 76 of file ThreadGroup.hpp.

Member Function Documentation

void addThread ( std::thread *  thrd)

Add an existing thread to the group.

Definition at line 125 of file ThreadGroup.hpp.

bool containsThisThread ( ) const

Check if the group contains the current thread.

Definition at line 83 of file ThreadGroup.hpp.

bool containsThread ( std::thread *  thrd) const

Check if the group contains a particular thread.

Definition at line 98 of file ThreadGroup.hpp.

std::thread* createThread ( thread_func)

Create a thread wrapping a functor and add it to the group.

Definition at line 116 of file ThreadGroup.hpp.

void joinAll ( )

Wait for all threads to finish.

Definition at line 147 of file ThreadGroup.hpp.

void removeThread ( std::thread *  thrd)

Remove a thread from the group.

Definition at line 137 of file ThreadGroup.hpp.


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