]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
b8ae064d | 2 | * Copyright (C) 1996-2023 The Squid Software Foundation and contributors |
bbc27441 AJ |
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 | ||
cfa20cf5 | 9 | #ifndef SQUID_ASYNCCALLQUEUE_H |
10 | #define SQUID_ASYNCCALLQUEUE_H | |
11 | ||
a928fdfd EB |
12 | #include "base/AsyncCallList.h" |
13 | #include "base/forward.h" | |
cfa20cf5 | 14 | |
15 | // The queue of asynchronous calls. All calls are fired during a single main | |
16 | // loop iteration until the queue is exhausted | |
17 | class AsyncCallQueue | |
18 | { | |
19 | public: | |
20 | // there is only one queue | |
26ac0430 | 21 | static AsyncCallQueue &Instance(); |
cfa20cf5 | 22 | |
23 | // make this async call when we get a chance | |
a928fdfd | 24 | void schedule(const AsyncCallPointer &call) { scheduled.add(call); } |
cfa20cf5 | 25 | |
26 | // fire all scheduled calls; returns true if at least one was fired | |
27 | bool fire(); | |
28 | ||
29 | private: | |
a928fdfd | 30 | AsyncCallQueue() = default; |
cfa20cf5 | 31 | |
a928fdfd | 32 | AsyncCallList scheduled; ///< calls waiting to be fire()d, in FIFO order |
cfa20cf5 | 33 | |
34 | static AsyncCallQueue *TheInstance; | |
35 | }; | |
36 | ||
37 | #endif /* SQUID_ASYNCCALLQUEUE_H */ | |
f53969cc | 38 |