|
Core Library
1.7.0.0
Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.
|
I/O Context Thread group class. More...
#include <IoContextThreadGroup.h>
Public Member Functions | |
| IoContextThreadGroup (unsigned int numThreads=std::thread::hardware_concurrency()) | |
| Initialising constuctor. More... | |
| IoContextThreadGroup (const IoContextThreadGroup &)=delete | |
| Copy constructor deleted. | |
| IoContextThreadGroup & | operator= (const IoContextThreadGroup &)=delete |
| Copy assignment operator deleted. | |
| IoContextThreadGroup (IoContextThreadGroup &&)=delete | |
| Move constructor deleted. | |
| IoContextThreadGroup & | operator= (IoContextThreadGroup &&)=delete |
| Move assignment operator deleted. | |
| ~IoContextThreadGroup () | |
| Destructor. | |
| boost_iocontext_t & | IoContext () |
| Get the I/O context. More... | |
| template<typename F > | |
| void | Post (F &&function) |
| Post a function object to be run by one of our threads. More... | |
Private Attributes | |
| boost_iocontext_t | m_ioContext |
| Boost ASIO I/O context. | |
| boost::asio::executor_work_guard< boost::asio::io_context::executor_type > | m_ioWorkGuard |
| Boost ASIO I/O context work guard object. | |
| threads::ThreadGroup | m_threadGroup |
| Our thread group. | |
I/O Context Thread group class.
This class implements a thread group mechanism for use by Boost's ASIO I/O context. This allows the I/O context to spread its work load across multiple threads. This class also calls run on the I/O context from each registered thread and also calls stop and joins all threads in its destructor.
|
explicit |
Initialising constuctor.
| [in] | numThreads | - (Optional) Number of threads to create. |
If the number of threads is not specified then the value will be assigned using std::thread::hardware_concurrency().
| boost_iocontext_t & core_lib::asio::IoContextThreadGroup::IoContext | ( | ) |
Get the I/O context.
|
inline |
Post a function object to be run by one of our threads.
| [in] | function | - Function to be run by one of our threads. |