0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Static Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
Hypertable::ReactorFactory Class Reference

Static class used to setup and manage I/O reactors. More...

#include <ReactorFactory.h>

Collaboration diagram for Hypertable::ReactorFactory:
Collaboration graph
[legend]

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< ReactorPtrms_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...
 

Detailed Description

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.

Member Function Documentation

void ReactorFactory::destroy ( )
static

This method shuts down the reactors.

Definition at line 85 of file ReactorFactory.cc.

static void Hypertable::ReactorFactory::get_reactor ( ReactorPtr reactor,
Reactor::Priority  priority = Reactor::Priority::NORMAL 
)
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.

Parameters
reactorSmart pointer reference to returned Reactor

Definition at line 81 of file ReactorFactory.h.

static void Hypertable::ReactorFactory::get_timer_reactor ( ReactorPtr reactor)
inlinestatic

This method returns the timer reactor.

Parameters
reactorSmart pointer reference to returned Reactor

Definition at line 93 of file ReactorFactory.h.

void ReactorFactory::initialize ( uint16_t  reactor_count)
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.

Parameters
reactor_countnumber of reactor threads to create

Definition at line 50 of file ReactorFactory.cc.

void ReactorFactory::join ( )
static

Joins with reactor threads.

Definition at line 94 of file ReactorFactory.cc.

Member Data Documentation

bool ReactorFactory::ms_epollet = true
static

Use "edge triggered" epoll.

Definition at line 108 of file ReactorFactory.h.

mutex ReactorFactory::ms_mutex
staticprivate

Mutex to serialize calls to initialize.

Definition at line 122 of file ReactorFactory.h.

atomic< int > ReactorFactory::ms_next_reactor
staticprivate

Atomic integer used for round-robin assignment of reactors.

Definition at line 125 of file ReactorFactory.h.

std::vector< ReactorPtr > ReactorFactory::ms_reactors
static

Vector of reactors (last position is timer reactor)

Definition at line 99 of file ReactorFactory.h.

boost::thread_group ReactorFactory::ms_threads
static

Boost thread_group for managing reactor threads.

Definition at line 102 of file ReactorFactory.h.

bool ReactorFactory::proxy_master = false
static

Set to true if this process is acting as "Proxy Master".

Definition at line 114 of file ReactorFactory.h.

default_random_engine ReactorFactory::rng
static

Pseudo random number generator.

Definition at line 105 of file ReactorFactory.h.

bool ReactorFactory::use_poll = false
static

Definition at line 111 of file ReactorFactory.h.

bool ReactorFactory::verbose {}
static

Verbose mode.

Definition at line 117 of file ReactorFactory.h.


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