0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ReactorRunner.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
28 #ifndef AsyncComm_REACTORRUNNER_H
29 #define AsyncComm_REACTORRUNNER_H
30 
31 #include "HandlerMap.h"
32 #include "Reactor.h"
33 
34 namespace Hypertable {
35 
40  class IOHandler;
41 
51  class ReactorRunner {
52  public:
53 
55  void operator()();
56 
60  void set_reactor(ReactorPtr &reactor) { m_reactor = reactor; }
61 
63  static bool shutdown;
64 
67  static bool record_arrival_time;
68 
71 
72  private:
73 
81  void cleanup_and_remove_handlers(std::set<IOHandler *> &handlers);
82 
84  };
86 }
87 
88 #endif // AsyncComm_REACTORRUNNER_H
void operator()()
Primary thread entry point.
Thread functor class for reacting to I/O events.
Definition: ReactorRunner.h:51
void cleanup_and_remove_handlers(std::set< IOHandler * > &handlers)
Cleans up and removes a set of handlers.
static bool record_arrival_time
If set to true arrival time is recorded and passed into IOHandler::handle.
Definition: ReactorRunner.h:67
static HandlerMapPtr handler_map
Smart pointer to HandlerMap.
Definition: ReactorRunner.h:70
std::shared_ptr< HandlerMap > HandlerMapPtr
Smart pointer to HandlerMap.
Definition: HandlerMap.h:437
std::shared_ptr< Reactor > ReactorPtr
Shared smart pointer to Reactor.
Definition: Reactor.h:295
Declarations for HandlerMap.
Declarations for Reactor.
Hypertable definitions
static bool shutdown
Flag indicating that reactor thread is being shut down.
Definition: ReactorRunner.h:63
ReactorPtr m_reactor
Smart pointer to reactor state object.
Definition: ReactorRunner.h:83
void set_reactor(ReactorPtr &reactor)
Assocates reactor state object with this ReactorRunner.
Definition: ReactorRunner.h:60