|
The Pedigree Project 0.1
|
#include <TimerHandlerRegistry.h>
Collaboration diagram for TimerHandlerRegistry:Classes | |
| struct | ActiveDispatch |
| struct | DispatchCleanup |
| struct | HandlerSlot |
Public Member Functions | |
| bool | registerHandler (TimerHandler *handler) |
| bool | unregisterHandler (TimerHandler *handler) |
| bool | dispatch (uint64_t delta, TimerHandler *onlyHandler=nullptr) |
| void | reset () |
Private Types | |
| enum class | SlotMode : size_t { Empty = 0 , Enabled , Draining , Deferred , Retiring } |
Private Member Functions | |
| bool | retireSlot (HandlerSlot &slot, size_t expectedPublication, TimerHandler *expectedHandler) |
| ActiveDispatch * | publishDispatch (HandlerSlot &slot, void *owner, void *token) |
| bool | unpublishDispatch (void *token, HandlerSlot &slot, size_t admittedPublication, bool required) |
| bool | hasActiveDispatch (HandlerSlot &slot) const |
| bool | findCurrentDispatch (void *owner, HandlerSlot *target, bool &callbackContext) const |
Static Private Member Functions | |
| static size_t | makePublication (size_t generation, SlotMode mode, bool selfRemoval=false, bool synchronousDrain=false) |
| static size_t | generationOf (size_t publication) |
| static SlotMode | modeOf (size_t publication) |
| static bool | selfRemovalOf (size_t publication) |
| static bool | synchronousDrainOf (size_t publication) |
| static void | abandonDispatch (void *context) |
| static void * | currentDispatchOwner () |
Private Attributes | |
| HandlerSlot | m_Handlers [MaxHandlerSlots] |
| ActiveDispatch | m_ActiveDispatches [MaxActiveDispatches] |
| WaitQueue | m_DispatchWaiters |
| Spinlock | m_HandlerLock |
Static Private Attributes | |
| static constexpr size_t | MaxHandlerSlots = 32 |
| static constexpr size_t | MaxActiveDispatches = 64 |
| static constexpr size_t | ModeBits = 3 |
| static constexpr size_t | ModeMask = (1 << ModeBits) - 1 |
| static constexpr size_t | SelfRemovalBit = 1 << ModeBits |
| static constexpr size_t | SynchronousDrainBit = 1 << (ModeBits + 1) |
| static constexpr size_t | GenerationShift = ModeBits + 2 |
Allocation-free timer callback registry with synchronous removal.
Dispatch pins atomically published slots without taking the writer lock. Removal closes admission before draining callbacks which committed a pin.
Definition at line 26 of file TimerHandlerRegistry.h.
|
strongprivate |
Definition at line 69 of file TimerHandlerRegistry.h.
| TimerHandlerRegistry::TimerHandlerRegistry | ( | ) |
Definition at line 18 of file TimerHandlerRegistry.cc.
|
staticprivate |
Definition at line 187 of file TimerHandlerRegistry.cc.
|
staticprivate |
Definition at line 237 of file TimerHandlerRegistry.cc.
| bool TimerHandlerRegistry::dispatch | ( | uint64_t | delta, |
| TimerHandler * | onlyHandler = nullptr |
||
| ) |
Calls each handler admitted by the current publication.
Definition at line 468 of file TimerHandlerRegistry.cc.
References ProcessorBase::information(), and TimerHandler::timer().
Referenced by Rtc::processElapsedTime(), and HostedTimer::processTimerBatch().
Here is the caller graph for this function:
|
private |
Definition at line 210 of file TimerHandlerRegistry.cc.
|
staticprivate |
Definition at line 39 of file TimerHandlerRegistry.cc.
|
private |
Definition at line 192 of file TimerHandlerRegistry.cc.
|
staticprivate |
Definition at line 33 of file TimerHandlerRegistry.cc.
|
staticprivate |
Definition at line 43 of file TimerHandlerRegistry.cc.
|
private |
Definition at line 72 of file TimerHandlerRegistry.cc.
| bool TimerHandlerRegistry::registerHandler | ( | TimerHandler * | handler | ) |
Definition at line 243 of file TimerHandlerRegistry.cc.
| void TimerHandlerRegistry::reset | ( | ) |
Clears quiescent registry state during timer lifecycle transitions.
Definition at line 540 of file TimerHandlerRegistry.cc.
Referenced by HostedTimer::initialise1(), Rtc::initialise1(), HostedTimer::uninitialise(), and Rtc::uninitialise().
Here is the caller graph for this function:
|
private |
Definition at line 55 of file TimerHandlerRegistry.cc.
|
staticprivate |
Definition at line 47 of file TimerHandlerRegistry.cc.
|
staticprivate |
Definition at line 51 of file TimerHandlerRegistry.cc.
|
private |
Definition at line 104 of file TimerHandlerRegistry.cc.
| bool TimerHandlerRegistry::unregisterHandler | ( | TimerHandler * | handler | ) |
Stops future callbacks and drains callbacks already in progress.
Self-removal is deferred until the callback returns and reports false, preserving Timer's synchronous boolean contract. Other atomic callers report false instead of waiting for an in-flight callback. A synchronous caller must not retain a resource which the active handler needs to finish.
Definition at line 297 of file TimerHandlerRegistry.cc.
References Spinlock::acquire(), ProcessorBase::getInterrupts(), ProcessorBase::information(), ProcessorBase::pause(), and Spinlock::release().
|
staticconstexprprivate |
Definition at line 81 of file TimerHandlerRegistry.h.
|
private |
Definition at line 133 of file TimerHandlerRegistry.h.
|
private |
Definition at line 134 of file TimerHandlerRegistry.h.
|
private |
Definition at line 135 of file TimerHandlerRegistry.h.
|
private |
Definition at line 132 of file TimerHandlerRegistry.h.
|
staticconstexprprivate |
Definition at line 67 of file TimerHandlerRegistry.h.
|
staticconstexprprivate |
Definition at line 66 of file TimerHandlerRegistry.h.
|
staticconstexprprivate |
Definition at line 77 of file TimerHandlerRegistry.h.
|
staticconstexprprivate |
Definition at line 78 of file TimerHandlerRegistry.h.
|
staticconstexprprivate |
Definition at line 79 of file TimerHandlerRegistry.h.
|
staticconstexprprivate |
Definition at line 80 of file TimerHandlerRegistry.h.