Static class used to setup and manage I/O reactors. More...
#include <ReactorFactory.h>
Static Public Member Functions | |
static void | initialize (uint16_t reactor_count) |
Initializes I/O reactors. More... | |
static void | destroy () |
This method shuts down the reactors. More... | |
static void | join () |
Joins with reactor threads. More... | |
static void | get_reactor (ReactorPtr &reactor, Reactor::Priority priority=Reactor::Priority::NORMAL) |
This method returns the 'next' reactor. More... | |
static void | get_timer_reactor (ReactorPtr &reactor) |
This method returns the timer reactor. More... | |
Static Public Attributes | |
static std::vector< ReactorPtr > | ms_reactors |
Vector of reactors (last position is timer reactor) More... | |
static boost::thread_group | ms_threads |
Boost thread_group for managing reactor threads. More... | |
static std::default_random_engine | rng |
Pseudo random number generator. More... | |
static bool | ms_epollet = true |
Use "edge triggered" epoll. More... | |
static bool | use_poll = false |
static bool | proxy_master = false |
Set to true if this process is acting as "Proxy Master". More... | |
static bool | verbose {} |
Verbose mode. More... | |
Static Private Attributes | |
static std::mutex | ms_mutex |
Mutex to serialize calls to initialize. More... | |
static std::atomic< int > | ms_next_reactor |
Atomic integer used for round-robin assignment of reactors. More... | |
Static class used to setup and manage I/O reactors.
Since the I/O reactor threads are a process-wide resource, the methods of this class are static.
Definition at line 52 of file ReactorFactory.h.
|
static |
This method shuts down the reactors.
Definition at line 85 of file ReactorFactory.cc.
|
inlinestatic |
This method returns the 'next' reactor.
It returns pointers to reactors in round-robin fashion and is used by the Comm subsystem to evenly distribute descriptors across all of the reactors. The atomic integer variable ms_next_reactor is used to keep track of the next reactor in the list.
reactor | Smart pointer reference to returned Reactor |
Definition at line 81 of file ReactorFactory.h.
|
inlinestatic |
This method returns the timer reactor.
reactor | Smart pointer reference to returned Reactor |
Definition at line 93 of file ReactorFactory.h.
|
static |
Initializes I/O reactors.
This method creates and initializes reactor_count
reactors, plus an additional dedicated timer reactor. It also initializes the use_poll member based on the Comm.UsePoll
property and sets the ms_epollet ("edge triggered") flag to false if running on Linux version older than 2.6.17. It also allocates a HandlerMap and initializes ReactorRunner::handler_map to point to it.
reactor_count | number of reactor threads to create |
Definition at line 50 of file ReactorFactory.cc.
|
static |
Joins with reactor threads.
Definition at line 94 of file ReactorFactory.cc.
|
static |
Use "edge triggered" epoll.
Definition at line 108 of file ReactorFactory.h.
|
staticprivate |
Mutex to serialize calls to initialize.
Definition at line 122 of file ReactorFactory.h.
|
staticprivate |
Atomic integer used for round-robin assignment of reactors.
Definition at line 125 of file ReactorFactory.h.
|
static |
Vector of reactors (last position is timer reactor)
Definition at line 99 of file ReactorFactory.h.
|
static |
Boost thread_group for managing reactor threads.
Definition at line 102 of file ReactorFactory.h.
|
static |
Set to true if this process is acting as "Proxy Master".
Definition at line 114 of file ReactorFactory.h.
|
static |
Pseudo random number generator.
Definition at line 105 of file ReactorFactory.h.
|
static |
Definition at line 111 of file ReactorFactory.h.
|
static |
Verbose mode.
Definition at line 117 of file ReactorFactory.h.