farm-ng-core
farm_ng::ThreadPool Class Reference

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::IoContextgetAsioIoContext ()
 Returns a shared pointer to the owned io_context. More...
 

Detailed Description

Class representing a pool of threads connected to a boost:asio::io_context.

Constructor & Destructor Documentation

◆ ThreadPool() [1/2]

farm_ng::ThreadPool::ThreadPool ( )

Constructor that creates a boost:asio::io_context.

◆ ThreadPool() [2/2]

farm_ng::ThreadPool::ThreadPool ( std::shared_ptr< Context::IoContext ctx)

Constructor for an existing boost:asio::io_context.

Member Function Documentation

◆ getAsioIoContext()

Context::IoContext & farm_ng::ThreadPool::getAsioIoContext ( )

Returns a shared pointer to the owned io_context.

◆ join()

void farm_ng::ThreadPool::join ( )

Joins the threads in the pool.

◆ start()

void farm_ng::ThreadPool::start ( size_t  n_threads)

Start the threadpool, given a thread count.

◆ stop()

void farm_ng::ThreadPool::stop ( )

Signals to the context to stop.


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