]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/base/AsyncCallQueue.cc
5 * DEBUG: section 41 Event Processing
10 #include "base/AsyncCallQueue.h"
11 #include "base/AsyncCall.h"
13 AsyncCallQueue
*AsyncCallQueue::TheInstance
= 0;
16 AsyncCallQueue::AsyncCallQueue(): theHead(NULL
), theTail(NULL
)
20 void AsyncCallQueue::schedule(AsyncCall::Pointer
&call
)
23 assert(!call
->theNext
);
24 if (theHead
!= NULL
) { // append
25 assert(!theTail
->theNext
);
26 theTail
->theNext
= call
;
28 } else { // create queue from cratch
29 theHead
= theTail
= call
;
33 // Fire all scheduled calls; returns true if at least one call was fired.
34 // The calls may be added while the current call is in progress.
36 AsyncCallQueue::fire()
38 const bool made
= theHead
!= NULL
;
39 while (theHead
!= NULL
)
45 AsyncCallQueue::fireNext()
47 AsyncCall::Pointer call
= theHead
;
48 theHead
= call
->theNext
;
53 debugs(call
->debugSection
, call
->debugLevel
, "entering " << *call
);
55 debugs(call
->debugSection
, call
->debugLevel
, "leaving " << *call
);
59 AsyncCallQueue::Instance()
61 // TODO: how to remove this frequent check while supporting early calls?
63 TheInstance
= new AsyncCallQueue();