5
* DEBUG: section 41 Event Processing
9
#include "base/AsyncCallQueue.h"
10
#include "base/AsyncCall.h"
12
AsyncCallQueue *AsyncCallQueue::TheInstance = 0;
15
AsyncCallQueue::AsyncCallQueue(): theHead(NULL), theTail(NULL)
19
void AsyncCallQueue::schedule(AsyncCall::Pointer &call)
22
assert(!call->theNext);
23
if (theHead != NULL) { // append
24
assert(!theTail->theNext);
25
theTail->theNext = call;
27
} else { // create queue from cratch
28
theHead = theTail = call;
32
// Fire all scheduled calls; returns true if at least one call was fired.
33
// The calls may be added while the current call is in progress.
35
AsyncCallQueue::fire()
37
const bool made = theHead != NULL;
38
while (theHead != NULL)
44
AsyncCallQueue::fireNext()
46
AsyncCall::Pointer call = theHead;
47
theHead = call->theNext;
52
debugs(call->debugSection, call->debugLevel, "entering " << *call);
54
debugs(call->debugSection, call->debugLevel, "leaving " << *call);
58
AsyncCallQueue::Instance()
60
// TODO: how to remove this frequent check while supporting early calls?
62
TheInstance = new AsyncCallQueue();