CatapultServer  v0.5.0.1 (Elephant)
IoThreadPool.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include <memory>
23 #include <string>
24 
25 namespace boost { namespace asio { class io_context; } }
26 
27 namespace catapult { namespace thread {
28 
30  class IoThreadPool {
31  public:
32  virtual ~IoThreadPool() = default;
33 
34  public:
36  virtual uint32_t numWorkerThreads() const = 0;
37 
39  virtual const std::string& tag() const = 0;
40 
42  virtual boost::asio::io_context& ioContext() = 0;
43 
44  public:
47  virtual void start() = 0;
48 
50  virtual void join() = 0;
51  };
52 
55  std::unique_ptr<IoThreadPool> CreateIoThreadPool(size_t numWorkerThreads, const char* name = nullptr);
56 }}
m_pContext
std::unique_ptr< ThreadPoolContext > m_pContext
Definition: IoThreadPool.cpp:130
m_threads
boost::thread_group m_threads
Definition: IoThreadPool.cpp:57
m_tag
std::string m_tag
Definition: IoThreadPool.cpp:127
ConnectionSecurityMode.h
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
ThreadInfo.h
exceptions.h
catapult::thread::IoThreadPool::numWorkerThreads
virtual uint32_t numWorkerThreads() const =0
Gets the number of active worker threads.
Parser.debug
def debug(*args)
Definition: Parser.py:46
MacroBasedEnum.h
PacketType.h
catapult::thread::IoThreadPool
Represents a thread pool that shares a single io context across multiple threads.
Definition: IoThreadPool.h:30
catapult::thread::IoThreadPool::~IoThreadPool
virtual ~IoThreadPool()=default
boost
Definition: IoThreadPool.h:25
catapult::ionet::ConnectionSecurityMode
ConnectionSecurityMode
Possible connection security modes.
Definition: ConnectionSecurityMode.h:36
m_numWorkerThreads
std::atomic< uint32_t > m_numWorkerThreads
Definition: IoThreadPool.cpp:131
AtomicIncrementDecrementGuard.h
catapult::thread::IoThreadPool::tag
virtual const std::string & tag() const =0
Gets the friendly name of this thread pool.
m_work
boost::asio::executor_work_guard< boost::asio::io_context::executor_type > m_work
Definition: IoThreadPool.cpp:56
catapult::thread::CreateIoThreadPool
std::unique_ptr< IoThreadPool > CreateIoThreadPool(size_t numWorkerThreads, const char *name)
Definition: IoThreadPool.cpp:146
ConnectResult.h
catapult::thread::IoThreadPool::ioContext
virtual boost::asio::io_context & ioContext()=0
Gets the underlying io_context.
CATAPULT_THROW_RUNTIME_ERROR_1
#define CATAPULT_THROW_RUNTIME_ERROR_1(MESSAGE, PARAM1)
Macro used to throw a catapult runtime error with a single parameter.
Definition: exceptions.h:171
catapult::ionet::NodeRoles::None
No roles.
PacketExtractor.h
catapult::thread::SetThreadName
void SetThreadName(const std::string &name)
Definition: ThreadInfo.cpp:69
catapult::thread::IoThreadPool::join
virtual void join()=0
Waits for all thread pool threads to exit.
IoThreadPool.h
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
catapult::utils::TryParseBitwiseEnumValue
bool TryParseBitwiseEnumValue(const std::array< std::pair< const char *, T >, N > &stringToValueMapping, const std::string &str, T &parsedValues)
Tries to parse str into a bitwise enum value (parsedValue) given a mapping of strings to values (stri...
Definition: ConfigurationValueParsers.h:118
MacroBasedEnumIncludes.h
catapult::utils::MakeIncrementDecrementGuard
AtomicIncrementDecrementGuard< T > MakeIncrementDecrementGuard(std::atomic< T > &value)
Factory function for creating AtomicIncrementDecrementGuard<T>.
Definition: AtomicIncrementDecrementGuard.h:48
ConfigurationValueParsers.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::thread::IoThreadPool::start
virtual void start()=0
m_numConfiguredWorkerThreads
size_t m_numConfiguredWorkerThreads
Definition: IoThreadPool.cpp:126
m_ioContext
boost::asio::io_context m_ioContext
Definition: IoThreadPool.cpp:129
catapult::ionet::TryParseValue
bool TryParseValue(const std::string &str, ConnectionSecurityMode &modes)
Tries to parse str into connection security modes.
Definition: IoEnums.cpp:72
Logging.h
SocketOperationCode.h