AsyncCallQueue.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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
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.
20bool
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)
32 return made;
33}
34
37{
38 // TODO: how to remove this frequent check while supporting early calls?
39 if (!TheInstance)
41
42 return *TheInstance;
43}
44
size_t size() const
the number of currently stored calls
Definition: AsyncCallList.h:34
AsyncCallPointer extract()
static AsyncCallQueue * TheInstance
AsyncCallQueue()=default
static AsyncCallQueue & Instance()
AsyncCallList scheduled
calls waiting to be fire()d, in FIFO order
static void Reset()
forgets the current context, setting it to nil/unknown
Definition: CodeContext.cc:75
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:196

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors