EventLoop.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_SRC_EVENTLOOP_H
10 #define SQUID_SRC_EVENTLOOP_H
11 
12 #include "time/forward.h"
13 
14 #include <vector>
15 
16 #define EVENT_LOOP_TIMEOUT 1000 /* 1s timeout */
17 
18 class AsyncEngine;
19 
26 class EventLoop
27 {
28 
29 public:
30  EventLoop();
31 
35  void registerEngine(AsyncEngine *engine);
36 
41  void run();
42 
48  bool runOnce();
49 
57  void setPrimaryEngine(AsyncEngine * engine);
58 
63 
67  void stop();
68 
69  int errcount;
70 
73  static EventLoop *Running;
74 
75 private:
77  void prepareToRun();
78 
80  void checkEngine(AsyncEngine * engine, bool const primary);
81 
83  bool dispatchCalls();
84 
85  bool last_loop;
86  typedef std::vector<AsyncEngine *> engine_vector;
90  int loop_delay;
91  bool error;
93 };
94 
95 #endif /* SQUID_SRC_EVENTLOOP_H */
96 
event class for doing synthetic time etc
Definition: Engine.h:15
static EventLoop * Running
Definition: EventLoop.h:73
void run()
Definition: EventLoop.cc:76
engine_vector engines
Definition: EventLoop.h:87
AsyncEngine * primaryEngine
Definition: EventLoop.h:89
bool error
Definition: EventLoop.h:91
std::vector< AsyncEngine * > engine_vector
Definition: EventLoop.h:86
void stop()
Definition: EventLoop.cc:168
bool runOnce()
Definition: EventLoop.cc:89
int loop_delay
Definition: EventLoop.h:90
void prepareToRun()
Definition: EventLoop.cc:63
int errcount
Definition: EventLoop.h:69
bool runOnceResult
Definition: EventLoop.h:92
bool last_loop
Definition: EventLoop.h:85
void setTimeService(Time::Engine *)
Definition: EventLoop.cc:162
void checkEngine(AsyncEngine *engine, bool const primary)
Definition: EventLoop.cc:29
Time::Engine * timeService
Definition: EventLoop.h:88
void setPrimaryEngine(AsyncEngine *engine)
Definition: EventLoop.cc:149
void registerEngine(AsyncEngine *engine)
Definition: EventLoop.cc:70
bool dispatchCalls()
Definition: EventLoop.cc:142

 

Introduction

Documentation

Support

Miscellaneous