farm-ng-core
|
Class representing a pool of threads connected to a boost:asio::io_context. More...
#include <thread_pool.h>
Public Member Functions | |
ThreadPool () | |
Constructor that creates a boost:asio::io_context. More... | |
ThreadPool (std::shared_ptr< Context::IoContext > ctx) | |
Constructor for an existing boost:asio::io_context. More... | |
void | stop () |
Signals to the context to stop. More... | |
void | start (size_t n_threads) |
Start the threadpool, given a thread count. More... | |
void | join () |
Joins the threads in the pool. More... | |
Context::IoContext & | getAsioIoContext () |
Returns a shared pointer to the owned io_context . More... | |
Class representing a pool of threads connected to a boost:asio::io_context.
farm_ng::ThreadPool::ThreadPool | ( | ) |
Constructor that creates a boost:asio::io_context.
farm_ng::ThreadPool::ThreadPool | ( | std::shared_ptr< Context::IoContext > | ctx | ) |
Constructor for an existing boost:asio::io_context.
Context::IoContext & farm_ng::ThreadPool::getAsioIoContext | ( | ) |
Returns a shared pointer to the owned io_context
.
void farm_ng::ThreadPool::join | ( | ) |
Joins the threads in the pool.
void farm_ng::ThreadPool::start | ( | size_t | n_threads | ) |
Start the threadpool, given a thread count.
void farm_ng::ThreadPool::stop | ( | ) |
Signals to the context to stop.