EventLoop.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_EVENTLOOP_H
10 #define SQUID_EVENTLOOP_H
11 
12 #include <vector>
13 
14 #define EVENT_LOOP_TIMEOUT 1000 /* 1s timeout */
15 
16 class AsyncEngine;
17 class TimeEngine;
18 
25 class EventLoop
26 {
27 
28 public:
29  EventLoop();
30 
34  void registerEngine(AsyncEngine *engine);
35 
40  void run();
41 
47  bool runOnce();
48 
56  void setPrimaryEngine(AsyncEngine * engine);
57 
61  void setTimeService(TimeEngine *engine);
62 
66  void stop();
67 
68  int errcount;
69 
72  static EventLoop *Running;
73 
74 private:
76  void prepareToRun();
77 
79  void checkEngine(AsyncEngine * engine, bool const primary);
80 
82  bool dispatchCalls();
83 
84  bool last_loop;
85  typedef std::vector<AsyncEngine *> engine_vector;
89  int loop_delay;
90  bool error;
92 };
93 
94 #endif /* SQUID_EVENTLOOP_H */
95 
void checkEngine(AsyncEngine *engine, bool const primary)
Definition: EventLoop.cc:29
void run()
Definition: EventLoop.cc:76
void stop()
Definition: EventLoop.cc:168
bool last_loop
Definition: EventLoop.h:84
bool error
Definition: EventLoop.h:90
int errcount
Definition: EventLoop.h:68
TimeEngine * timeService
Definition: EventLoop.h:87
bool dispatchCalls()
Definition: EventLoop.cc:142
AsyncEngine * primaryEngine
Definition: EventLoop.h:88
void prepareToRun()
Definition: EventLoop.cc:63
bool runOnceResult
Definition: EventLoop.h:91
static EventLoop * Running
Definition: EventLoop.h:72
engine_vector engines
Definition: EventLoop.h:86
void setPrimaryEngine(AsyncEngine *engine)
Definition: EventLoop.cc:149
bool runOnce()
Definition: EventLoop.cc:89
int loop_delay
Definition: EventLoop.h:89
std::vector< AsyncEngine * > engine_vector
Definition: EventLoop.h:85
void registerEngine(AsyncEngine *engine)
Definition: EventLoop.cc:70
void setTimeService(TimeEngine *engine)
Definition: EventLoop.cc:162

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors