matador::leader_follower_thread_pool Class Reference

#include <leader_follower_thread_pool.hpp>

Public Member Functions

template<typename F >
 leader_follower_thread_pool (std::size_t size, F join_func)
 
void start ()
 
void stop ()
 
void promote_new_leader ()
 
std::size_t size () const
 
void shutdown ()
 
std::thread::id leader ()
 
std::size_t num_follower () const
 
bool is_running () const
 

Detailed Description

This thread pool class implements the leader follower pattern.

Constructor & Destructor Documentation

◆ leader_follower_thread_pool()

template<typename F >
matador::leader_follower_thread_pool::leader_follower_thread_pool ( std::size_t  size,
join_func 
)
inline

Creates a new leader follower thread pool instance with the given thread pool size and given join function.

Template Parameters
FType of join function
Parameters
sizeNumber of threads
join_funcJoin function.

Member Function Documentation

◆ is_running()

bool matador::leader_follower_thread_pool::is_running ( ) const

Returns true if the thread pool is running.

Returns
True if thread pool is running.

◆ leader()

std::thread::id matador::leader_follower_thread_pool::leader ( )

Returns the thread id of the current leading thread.

Returns
Thread id of the leading thread.

◆ num_follower()

std::size_t matador::leader_follower_thread_pool::num_follower ( ) const

Returns the current number of thread followers.

Returns
Number of follower threads.

◆ promote_new_leader()

void matador::leader_follower_thread_pool::promote_new_leader ( )

Promotes the next new leading thread.

◆ shutdown()

void matador::leader_follower_thread_pool::shutdown ( )

Shuts the thread pool down.

◆ size()

std::size_t matador::leader_follower_thread_pool::size ( ) const

Returns number of threads.

Returns
Number of threads.

◆ start()

void matador::leader_follower_thread_pool::start ( )

Starts the thread pool.

◆ stop()

void matador::leader_follower_thread_pool::stop ( )

Stops the thread pool.


The documentation for this class was generated from the following file:
  • matador/net/leader_follower_thread_pool.hpp