Squid Web Cache
master
Loading...
Searching...
No Matches
AsyncEngine.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2025 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_ASYNCENGINE_H
10
#define SQUID_SRC_ASYNCENGINE_H
11
12
/* Abstract interface for async engines which an event loop can utilise.
13
*
14
* Some implementations will be truly async, others like the event engine
15
* will be pseudo async.
16
*/
17
18
class
AsyncEngine
19
{
20
21
public
:
22
/* error codes returned from checkEvents. If the return value is not
23
* negative, then it is the requested delay until the next call. If it is
24
* negative, it is one of the following codes:
25
*/
26
enum
CheckError
{
27
/* this engine is completely idle: it has no pending events, and nothing
28
* registered with it that can create events
29
*/
30
EVENT_IDLE
= -1,
31
/* some error has occurred in this engine */
32
EVENT_ERROR
= -2
33
};
34
35
virtual
~AsyncEngine
() {}
36
37
/* Check the engine for events. If there are events that have completed,
38
* the engine should at this point hand them off to their dispatcher.
39
* Engines that operate asynchronously - i.e. the DiskThreads engine -
40
* should hand events off to their dispatcher as they arrive rather than
41
* waiting for checkEvents to be called. Engines like poll and select should
42
* use this call as the time to perform their checks with the OS for new
43
* events.
44
*
45
* The return value is the status code of the event checking. If its a
46
* non-negative value then it is used as hint for the minimum requested
47
* time before checkEvents is called again. I.e. the event engine knows
48
* how long it is until the next event will be scheduled - so it will
49
* return that time (in milliseconds).
50
*
51
* The timeout value is a requested timeout for this engine - the engine
52
* should not block for more than this period. (If it takes longer than the
53
* timeout to do actual checks that's fine though undesirable).
54
*/
55
virtual
int
checkEvents
(
int
timeout) = 0;
56
};
57
58
#endif
/* SQUID_SRC_ASYNCENGINE_H */
59
AsyncEngine
Definition
AsyncEngine.h:19
AsyncEngine::checkEvents
virtual int checkEvents(int timeout)=0
AsyncEngine::~AsyncEngine
virtual ~AsyncEngine()
Definition
AsyncEngine.h:35
AsyncEngine::CheckError
CheckError
Definition
AsyncEngine.h:26
AsyncEngine::EVENT_IDLE
@ EVENT_IDLE
Definition
AsyncEngine.h:30
AsyncEngine::EVENT_ERROR
@ EVENT_ERROR
Definition
AsyncEngine.h:32
squid
src
AsyncEngine.h
Generated by
1.9.8