Squid Web Cache
master
Loading...
Searching...
No Matches
AsyncCallQueue.cc
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
/* DEBUG: section 41 Event Processing */
10
11
#include "
squid.h
"
12
#include "
base/AsyncCall.h
"
13
#include "
base/AsyncCallQueue.h
"
14
#include "
debug/Stream.h
"
15
16
AsyncCallQueue
*
AsyncCallQueue::TheInstance
=
nullptr
;
17
18
// Fire all scheduled calls; returns true if at least one call was fired.
19
// The calls may be added while the current call is in progress.
20
bool
21
AsyncCallQueue::fire
()
22
{
23
const
auto
made =
scheduled
.
size
() > 0;
24
while
(
const
auto
call =
scheduled
.
extract
()) {
25
CodeContext::Reset
(call->codeContext);
26
debugs
(call->debugSection, call->debugLevel,
"entering "
<< *call);
27
call->make();
28
debugs
(call->debugSection, call->debugLevel,
"leaving "
<< *call);
29
}
30
if
(made)
31
CodeContext::Reset
();
32
return
made;
33
}
34
35
AsyncCallQueue
&
36
AsyncCallQueue::Instance
()
37
{
38
// TODO: how to remove this frequent check while supporting early calls?
39
if
(!
TheInstance
)
40
TheInstance
=
new
AsyncCallQueue
();
41
42
return
*
TheInstance
;
43
}
44
AsyncCallQueue.h
AsyncCall.h
AsyncCallList::size
size_t size() const
the number of currently stored calls
Definition
AsyncCallList.h:34
AsyncCallList::extract
AsyncCallPointer extract()
Definition
AsyncCallList.cc:33
AsyncCallQueue
Definition
AsyncCallQueue.h:18
AsyncCallQueue::TheInstance
static AsyncCallQueue * TheInstance
Definition
AsyncCallQueue.h:34
AsyncCallQueue::AsyncCallQueue
AsyncCallQueue()=default
AsyncCallQueue::Instance
static AsyncCallQueue & Instance()
Definition
AsyncCallQueue.cc:36
AsyncCallQueue::fire
bool fire()
Definition
AsyncCallQueue.cc:21
AsyncCallQueue::scheduled
AsyncCallList scheduled
calls waiting to be fire()d, in FIFO order
Definition
AsyncCallQueue.h:32
CodeContext::Reset
static void Reset()
forgets the current context, setting it to nil/unknown
Definition
CodeContext.cc:77
Stream.h
debugs
#define debugs(SECTION, LEVEL, CONTENT)
Definition
Stream.h:192
squid.h
squid
src
base
AsyncCallQueue.cc
Generated by
1.9.8