7#ifndef HTTP_THREAD_POOL_H
8#define HTTP_THREAD_POOL_H
13#include <boost/shared_ptr.hpp>
15#include <condition_variable>
44 bool defer_start =
false);
117 void checkPermissions(
State state);
122 bool checkThreadId(std::thread::id
id);
158 void setState(
State state);
170 bool validateStateChange(
State state)
const;
176 static std::string stateToText(
State state);
239 std::condition_variable thread_cv_;
243 std::condition_variable main_cv_;
256 std::list<boost::shared_ptr<std::thread> > threads_;
Implements a pausable pool of IOService driven threads.
void pause()
Transitions the pool from RUNNING to PAUSED.
asiolink::IOServicePtr getIOService() const
Fetches the IOService that drives the pool.
bool isStopped()
Check if the thread pool is stopped.
bool isPaused()
Check if the thread pool is paused.
uint16_t getPoolSize() const
Fetches the maximum size of the thread pool.
void stop()
Transitions the pool from RUNNING or PAUSED to STOPPED.
void checkPausePermissions()
Check current thread permissions to transition to the new PAUSED state.
~HttpThreadPool()
Destructor.
bool isRunning()
Check if the thread pool is running.
HttpThreadPool(asiolink::IOServicePtr io_service, size_t pool_size, bool defer_start=false)
Constructor.
void run()
Transitions the pool from STOPPED or PAUSED to RUNNING.
uint16_t getThreadCount() const
Fetches the number of threads in the pool.
State
Describes the possible operational state of the thread pool.
@ RUNNING
Pool is not operational.
@ PAUSED
Pool is populated with running threads.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
boost::shared_ptr< HttpThreadPool > HttpThreadPoolPtr
Defines a pointer to a thread pool.
Defines the logger used by the top-level component of kea-lfc.