te::common::ThreadGroup Class Reference

This class represents a thread group. More...

#include <ThreadGroup.h>

Public Member Functions

template<typename Function >
void addJob (Function func)
 Waits for all threads to finish their jobs. More...
 
 ThreadGroup (std::size_t numberOfThreads=std::string::npos)
 < Constructor. If the number of thread is not especified, it will use all available threads More...
 
void waitToFinish ()
 
 ~ThreadGroup ()
 Creates a new job and binds it to the given function. Use std::bind(function, object, params...) as argument. More...
 

Protected Attributes

std::unique_ptr< boost::asio::io_service > m_ioService
 Boost IO service. More...
 
std::unique_ptr< boost::thread_group > m_threadGroup
 Boost thread group. More...
 
std::unique_ptr< boost::asio::io_service::work > m_work
 Boost work. More...
 

Detailed Description

This class represents a thread group.

Definition at line 50 of file ThreadGroup.h.

Constructor & Destructor Documentation

◆ ThreadGroup()

te::common::ThreadGroup::ThreadGroup ( std::size_t  numberOfThreads = std::string::npos)

< Constructor. If the number of thread is not especified, it will use all available threads

Destructor

◆ ~ThreadGroup()

te::common::ThreadGroup::~ThreadGroup ( )

Creates a new job and binds it to the given function. Use std::bind(function, object, params...) as argument.

Member Function Documentation

◆ addJob()

template<typename Function >
void te::common::ThreadGroup::addJob ( Function  func)

Waits for all threads to finish their jobs.

Definition at line 76 of file ThreadGroup.h.

References m_ioService.

◆ waitToFinish()

void te::common::ThreadGroup::waitToFinish ( )

Member Data Documentation

◆ m_ioService

std::unique_ptr<boost::asio::io_service> te::common::ThreadGroup::m_ioService
protected

Boost IO service.

Definition at line 69 of file ThreadGroup.h.

Referenced by addJob().

◆ m_threadGroup

std::unique_ptr<boost::thread_group> te::common::ThreadGroup::m_threadGroup
protected

Boost thread group.

Definition at line 70 of file ThreadGroup.h.

◆ m_work

std::unique_ptr<boost::asio::io_service::work> te::common::ThreadGroup::m_work
protected

Boost work.

Definition at line 71 of file ThreadGroup.h.


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