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. | |
| std::size_t | getThreadCount () |
| Creates a new job and binds it to the given function. Use std::bind(function, object, params...) as argument. | |
| ThreadGroup (std::size_t threadCount=0) | |
| < Constructor. If the given thread count is 0, it will detect and use all available threads | |
| void | waitToFinish () |
| ~ThreadGroup () | |
| Gets the number of threads that are defined to be used by this class. | |
Private Member Functions | |
| void | run () |
| < Starts the execution of the thread group. Note that the jobs must be added before the calling of this function | |
Private Attributes | |
| std::unique_ptr< boost::asio::io_service > | m_ioService |
| Boost IO service. | |
| std::size_t | m_threadCount |
| std::unique_ptr< boost::thread_group > | m_threadGroup |
| Boost thread group. | |
| std::unique_ptr< boost::asio::io_service::work > | m_work |
| Boost work. | |
This class represents a thread group.
Definition at line 50 of file ThreadGroup.h.
| te::common::ThreadGroup::ThreadGroup | ( | std::size_t | threadCount = 0 | ) |
< Constructor. If the given thread count is 0, it will detect and use all available threads
Destructor
| te::common::ThreadGroup::~ThreadGroup | ( | ) |
Gets the number of threads that are defined to be used by this class.
| void te::common::ThreadGroup::addJob | ( | Function | func | ) |
Waits for all threads to finish their jobs.
Definition at line 85 of file ThreadGroup.h.
References m_ioService.
Referenced by getThreadCount().
| std::size_t te::common::ThreadGroup::getThreadCount | ( | ) |
Creates a new job and binds it to the given function. Use std::bind(function, object, params...) as argument.
References addJob().
|
private |
< Starts the execution of the thread group. Note that the jobs must be added before the calling of this function
| void te::common::ThreadGroup::waitToFinish | ( | ) |
|
private |
|
private |
Definition at line 77 of file ThreadGroup.h.
|
private |
Boost thread group.
Definition at line 79 of file ThreadGroup.h.
|
private |
Boost work.
Definition at line 80 of file ThreadGroup.h.