Public Member Functions | |
HappyOrderEnforcer (const char *aName) | |
void | checkpoint () |
resumes jobs that need resuming (if any) More... | |
void | enqueue (HappyConnOpener &) |
starts managing the job's wait; the job should expect a call back More... | |
void | dequeue (HappyConnOpener &) |
stops managing the job's wait; cancels the pending callback, if any More... | |
Public Attributes | |
const char *const | name |
waiting event name, for debugging More... | |
Protected Member Functions | |
virtual bool | readyNow (const HappyConnOpener &) const =0 |
virtual AsyncCall::Pointer | notify (const CbcPointer< HappyConnOpener > &)=0 |
bool | waiting () const |
bool | startedWaiting (const HappyAbsoluteTime lastStart, const int cfgTimeoutMsec) const |
Private Member Functions | |
void | noteWaitOver () |
Static Private Member Functions | |
static void | NoteWaitOver (void *raw) |
Private Attributes | |
HappySpareWaitList | jobs_ |
queued jobs waiting their turn More... | |
HappyAbsoluteTime | waitEnd_ = 0 |
expected NoteWaitOver() call time (or zero) More... | |
Detailed Description
Efficiently drains a FIFO HappyConnOpener queue while delaying each "pop" event by the time determined by the top element currently in the queue. Its current cbdata-free implementation assumes static storage duration.
Definition at line 54 of file HappyConnOpener.cc.
Constructor & Destructor Documentation
◆ HappyOrderEnforcer()
|
inline |
- Parameters
-
aName names scheduled events, for debugging
Definition at line 58 of file HappyConnOpener.cc.
Member Function Documentation
◆ checkpoint()
void HappyOrderEnforcer::checkpoint | ( | ) |
Definition at line 173 of file HappyConnOpener.cc.
References CallBack(), jobs_, and readyNow().
Referenced by SpareAllowanceGiver::forgetAllowance(), and noteWaitOver().
◆ dequeue()
void HappyOrderEnforcer::dequeue | ( | HappyConnOpener & | job | ) |
Definition at line 161 of file HappyConnOpener.cc.
References HappySpareWait::callback, AsyncCall::cancel(), jobs_, Must, HappySpareWait::position, and HappyConnOpener::spareWaiting.
Referenced by HappyConnOpener::stopGivingPrimeItsChance(), and HappyConnOpener::stopWaitingForSpareAllowance().
◆ enqueue()
void HappyOrderEnforcer::enqueue | ( | HappyConnOpener & | job | ) |
Definition at line 152 of file HappyConnOpener.cc.
References HappySpareWait::callback, HappySpareWait::codeContext, CodeContext::Current(), jobs_, Must, HappySpareWait::position, and HappyConnOpener::spareWaiting.
Referenced by HappyConnOpener::maybeGivePrimeItsChance(), and HappyConnOpener::maybeOpenSpareConnection().
◆ noteWaitOver()
|
private |
Definition at line 224 of file HappyConnOpener.cc.
References checkpoint(), Must, waitEnd_, and waiting().
Referenced by NoteWaitOver().
◆ NoteWaitOver()
|
staticprivate |
Definition at line 217 of file HappyConnOpener.cc.
References assert, and noteWaitOver().
Referenced by startedWaiting().
◆ notify()
|
protectedpure virtual |
Implemented in PrimeChanceGiver, and SpareAllowanceGiver.
◆ readyNow()
|
protectedpure virtual |
Implemented in PrimeChanceGiver, and SpareAllowanceGiver.
Referenced by checkpoint().
◆ startedWaiting()
|
protected |
Definition at line 189 of file HappyConnOpener.cc.
References assert, Config, current_dtime, eventAdd(), min(), name, NoteWaitOver(), waitEnd_, waiting(), and SquidConfig::workers.
Referenced by PrimeChanceGiver::readyNow(), and SpareAllowanceGiver::readyNow().
◆ waiting()
|
inlineprotected |
Definition at line 75 of file HappyConnOpener.cc.
References waitEnd_.
Referenced by noteWaitOver(), and startedWaiting().
Member Data Documentation
◆ jobs_
|
private |
Definition at line 82 of file HappyConnOpener.cc.
Referenced by checkpoint(), dequeue(), and enqueue().
◆ name
const char* const HappyOrderEnforcer::name |
Definition at line 69 of file HappyConnOpener.cc.
Referenced by startedWaiting().
◆ waitEnd_
|
mutableprivate |
Definition at line 83 of file HappyConnOpener.cc.
Referenced by noteWaitOver(), startedWaiting(), and waiting().
The documentation for this class was generated from the following file: