]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/base/AsyncCallQueue.cc
3 * DEBUG: section 41 Event Processing
8 #include "base/AsyncCall.h"
9 #include "base/AsyncCallQueue.h"
12 AsyncCallQueue
*AsyncCallQueue::TheInstance
= 0;
14 AsyncCallQueue::AsyncCallQueue(): theHead(NULL
), theTail(NULL
)
18 void AsyncCallQueue::schedule(AsyncCall::Pointer
&call
)
21 assert(!call
->theNext
);
22 if (theHead
!= NULL
) { // append
23 assert(!theTail
->theNext
);
24 theTail
->theNext
= call
;
26 } else { // create queue from cratch
27 theHead
= theTail
= call
;
31 // Fire all scheduled calls; returns true if at least one call was fired.
32 // The calls may be added while the current call is in progress.
34 AsyncCallQueue::fire()
36 const bool made
= theHead
!= NULL
;
37 while (theHead
!= NULL
)
43 AsyncCallQueue::fireNext()
45 AsyncCall::Pointer call
= theHead
;
46 theHead
= call
->theNext
;
51 debugs(call
->debugSection
, call
->debugLevel
, "entering " << *call
);
53 debugs(call
->debugSection
, call
->debugLevel
, "leaving " << *call
);
57 AsyncCallQueue::Instance()
59 // TODO: how to remove this frequent check while supporting early calls?
61 TheInstance
= new AsyncCallQueue();