]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/AsyncCallQueue.cc
e6d1471f4cb4fff9c3f7aa713a6ed7db1dfe8a15
5 * DEBUG: section 41 Event Processing
9 #include "AsyncCallQueue.h"
10 #include "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();