The Pedigree Project 0.1
Classes | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SchedulerTimerHandlerSlot Class Reference

#include <SchedulerTimerHandlerSlot.h>

+ Collaboration diagram for SchedulerTimerHandlerSlot:

Classes

class  DispatchGuard
 

Public Member Functions

bool publish (size_t owner, SchedulerTimerHandler *handler)
 
bool unpublish (size_t owner, SchedulerTimerHandler *handler)
 
bool beginDispatch (size_t owner, DispatchGuard &guard)
 
bool isPublished (size_t owner, SchedulerTimerHandler *handler) const
 
size_t activeDispatches () const
 

Static Public Attributes

static constexpr size_t NoOwner = ~static_cast<size_t>(0)
 

Private Types

enum  State : size_t { Empty , Publishing , Published , Removing }
 

Private Member Functions

 SchedulerTimerHandlerSlot (const SchedulerTimerHandlerSlot &)=delete
 
SchedulerTimerHandlerSlotoperator= (const SchedulerTimerHandlerSlot &)=delete
 
void completeDispatch ()
 

Private Attributes

SchedulerTimerHandlerm_Handler
 
size_t m_Owner
 
size_t m_State
 

Static Private Attributes

static constexpr size_t ModeMask = 3
 
static constexpr size_t DispatchIncrement = ModeMask + 1
 
static constexpr size_t DispatchCountMask = ~ModeMask
 

Detailed Description

Lock-free, processor-owned publication for a hard scheduler-timer callback.

A scheduler timer invokes only the handler owned by the processor which received the tick. A callback may context-switch away with its interrupt frame still suspended, so admission is counted rather than exclusive. Removal succeeds only when it can close an idle publication; it never waits on a callback which needs this same processor to run again.

Definition at line 29 of file SchedulerTimerHandlerSlot.h.

Member Enumeration Documentation

◆ State

enum SchedulerTimerHandlerSlot::State : size_t
private

Definition at line 180 of file SchedulerTimerHandlerSlot.h.

Constructor & Destructor Documentation

◆ SchedulerTimerHandlerSlot()

SchedulerTimerHandlerSlot::SchedulerTimerHandlerSlot ( )
inline

Definition at line 71 of file SchedulerTimerHandlerSlot.h.

Member Function Documentation

◆ activeDispatches()

size_t SchedulerTimerHandlerSlot::activeDispatches ( ) const
inline

Lock-free diagnostic count of admitted, not-yet-returned callbacks.

Definition at line 166 of file SchedulerTimerHandlerSlot.h.

◆ beginDispatch()

bool SchedulerTimerHandlerSlot::beginDispatch ( size_t  owner,
DispatchGuard guard 
)
inline

Admit one callback and bind its lifetime to the supplied guard.

Definition at line 120 of file SchedulerTimerHandlerSlot.h.

Referenced by LocalApicTimerHandlerSlots::beginDispatch().

+ Here is the caller graph for this function:

◆ completeDispatch()

void SchedulerTimerHandlerSlot::completeDispatch ( )
inlineprivate

Definition at line 196 of file SchedulerTimerHandlerSlot.h.

◆ isPublished()

bool SchedulerTimerHandlerSlot::isPublished ( size_t  owner,
SchedulerTimerHandler handler 
) const
inline

Test/diagnostic predicate which never exposes a callback pointer.

Definition at line 156 of file SchedulerTimerHandlerSlot.h.

Referenced by LocalApicTimerHandlerSlots::isPublished().

+ Here is the caller graph for this function:

◆ publish()

bool SchedulerTimerHandlerSlot::publish ( size_t  owner,
SchedulerTimerHandler handler 
)
inline

Publish only when the slot has no owner, including no duplicate owner.

Definition at line 74 of file SchedulerTimerHandlerSlot.h.

Referenced by LocalApicTimerHandlerSlots::registerHandler(), HostedSchedulerTimer::registerHandler(), and Pit::registerHandler().

+ Here is the caller graph for this function:

◆ unpublish()

bool SchedulerTimerHandlerSlot::unpublish ( size_t  owner,
SchedulerTimerHandler handler 
)
inline

Unpublish only when handler belongs to the calling processor.

A true return is a callback-lifetime barrier: this processor cannot concurrently execute its timer hard frame, and future frames reject the closing slot before loading the callback pointer.

Definition at line 97 of file SchedulerTimerHandlerSlot.h.

Referenced by LocalApicTimerHandlerSlots::removeHandler(), HostedSchedulerTimer::removeHandler(), and Pit::removeHandler().

+ Here is the caller graph for this function:

Member Data Documentation

◆ DispatchCountMask

constexpr size_t SchedulerTimerHandlerSlot::DispatchCountMask = ~ModeMask
staticconstexprprivate

Definition at line 189 of file SchedulerTimerHandlerSlot.h.

◆ DispatchIncrement

constexpr size_t SchedulerTimerHandlerSlot::DispatchIncrement = ModeMask + 1
staticconstexprprivate

Definition at line 188 of file SchedulerTimerHandlerSlot.h.

◆ m_Handler

SchedulerTimerHandler* SchedulerTimerHandlerSlot::m_Handler
private

Definition at line 203 of file SchedulerTimerHandlerSlot.h.

◆ m_Owner

size_t SchedulerTimerHandlerSlot::m_Owner
private

Definition at line 204 of file SchedulerTimerHandlerSlot.h.

◆ m_State

size_t SchedulerTimerHandlerSlot::m_State
private

Definition at line 205 of file SchedulerTimerHandlerSlot.h.

◆ ModeMask

constexpr size_t SchedulerTimerHandlerSlot::ModeMask = 3
staticconstexprprivate

Definition at line 187 of file SchedulerTimerHandlerSlot.h.

◆ NoOwner

constexpr size_t SchedulerTimerHandlerSlot::NoOwner = ~static_cast<size_t>(0)
staticconstexpr

Definition at line 31 of file SchedulerTimerHandlerSlot.h.


The documentation for this class was generated from the following file: