ADC Home > Reference Library > Reference > Darwin > Kernel Framework Reference
|
IOTimerEventSource |
Inherits from: | |
Declared In: |
Time based event source mechanism.
An event source that implements a simple timer. A timeout handler is called once the timeout period expires. This timeout handler will be called by the work-loop that this event source is attached to.
Usually a timer event source will be used to implement a timeout. In general when a driver makes a request it will need to setup a call to keep track of when the I/O doesn't complete. This class is designed to make that somewhat easier.
Remember the system doesn't guarantee the accuracy of the callout. It is possible that a higher priority thread is running which will delay the execution of the action routine. In fact the thread will be made runable at the exact requested time, within the accuracy of the CPU's decrementer based interrupt, but the scheduler will then control execution.
Disable any outstanding calls to this event source.
Have to implement it is mandatory in IOEventSource, but IOTimerEventSources don't actually use this work-loop mechanism.
Disable a timed callout.
Enables a call to the action.
Sub-class implementation of free method, frees calloutEntry
Initializes the timer with an owner, and a handler to call when the timeout expires.
Setup a callback at after the delay in decrementer ticks. See wakeAtTime(AbsoluteTime).
Setup a callback at after the delay in decrementer ticks. See wakeAtTime(AbsoluteTime).
Setup a callback at after the delay in some unit. See wakeAtTime(AbsoluteTime).
Set's timeout as the function of calloutEntry.
Setup a callback at after the delay in milliseconds. See wakeAtTime(AbsoluteTime).
Setup a callback at after the delay in scheduler ticks. See wakeAtTime(AbsoluteTime).
Setup a callback at after the delay in microseconds. See wakeAtTime(AbsoluteTime).
Function that routes the call from the OS' timeout mechanism into a work-loop context.
Allocates and returns an initialized timer instance.
Setup a callback at this absolute time.
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
cancelTimeout |
Disable any outstanding calls to this event source.
public
virtual void cancelTimeout();
Clear down any oustanding calls. By the time this function completes it is guaranteed that the action will not be called again.
checkForWork |
Have to implement it is mandatory in IOEventSource, but IOTimerEventSources don't actually use this work-loop mechanism.
protected
virtual bool checkForWork();
disable |
Disable a timed callout.
public
virtual void disable();
When disable returns the action will not be called until the next time enable(qv) is called.
enable |
Enables a call to the action.
public
virtual void enable();
Allows the action function to be called. If the timer event source was disabled while a call was outstanding and the call wasn't cancelled then it will be rescheduled. So a disable/enable pair will disable calls from this event source.
free |
Sub-class implementation of free method, frees calloutEntry
protected
virtual void free();
init |
Initializes the timer with an owner, and a handler to call when the timeout expires.
public
virtual bool init( OSObject *owner, Action action = 0);
owner
action
setTimeout |
Setup a callback at after the delay in decrementer ticks. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn setTimeout( AbsoluteTime interval);
interval
Delay from now to wake up in decrementer ticks.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
setTimeout(mach_timespec_t) |
Setup a callback at after the delay in decrementer ticks. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn setTimeout( mach_timespec_t interval);
interval
Delay from now to wake up.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
setTimeout(UInt32, UInt32) |
Setup a callback at after the delay in some unit. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn setTimeout( UInt32 interval, UInt32 scale_factor = kNanosecondScale);
interval
Delay from now to wake up in some defined unit.
scale_factor
Define the unit of interval, default to nanoseconds.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
setTimeoutFunc |
Set's timeout as the function of calloutEntry.
protected
virtual void setTimeoutFunc();
IOTimerEventSource is based upon the kern/thread_call.h APIs currently. This function allocates the calloutEntry member variable by using thread_call_allocate(timeout, this). If you need to write your own subclass of IOTimerEventSource you probably should override this method to allocate an entry that points to your own timeout routine.
setTimeoutMS |
Setup a callback at after the delay in milliseconds. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn setTimeoutMS( UInt32 ms);
interval
Delay from now to wake up, time in milliseconds.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
setTimeoutTicks |
Setup a callback at after the delay in scheduler ticks. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn setTimeoutTicks( UInt32 ticks);
interval
Delay from now to wake up, in scheduler ticks, whatever that may be.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
setTimeoutUS |
Setup a callback at after the delay in microseconds. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn setTimeoutUS( UInt32 us);
interval
Delay from now to wake up, time in microseconds.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
timeout |
Function that routes the call from the OS' timeout mechanism into a work-loop context.
protected
static void timeout( void *self);
self
This argument will be cast to an IOTimerEventSource.
timeout will normally not be called nor overridden by a subclass. If the event source is enabled then close the work-loop's gate and call the action routine.
timerEventSource |
Allocates and returns an initialized timer instance.
public
static IOTimerEventSource * timerEventSource( OSObject *owner, Action action = 0);
owner
action
wakeAtTime |
Setup a callback at this absolute time.
public
virtual IOReturn wakeAtTime( AbsoluteTime abstime);
abstime
Absolute Time when to wake up, counted in 'decrementer' units and starts at zero when system boots.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared by init or IOEventSource::setAction (qqv).
Starts the timer, which will expire at abstime. After it expires, the timer will call the 'action' registered in the init() function. This timer is not periodic, a further call is needed to reset and restart the timer after it expires.
wakeAtTime(mach_timespec_t) |
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn wakeAtTime( mach_timespec_t abstime);
abstime
mach_timespec_t of the desired callout time.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
wakeAtTime(UInt32, UInt32) |
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn wakeAtTime( UInt32 abstime, UInt32 scale_factor = kNanosecondScale);
abstime
Time to wake up in some unit.
scale_factor
Define the unit of abstime, default to nanoseconds.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
wakeAtTimeMS |
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn wakeAtTimeMS( UInt32 ms);
abstime
Time to wake up in milliseconds.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
wakeAtTimeTicks |
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn wakeAtTimeTicks( UInt32 ticks);
abstime
Time to wake up in scheduler quantums, whatever that is?
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
wakeAtTimeUS |
Setup a callback at this absolute time. See wakeAtTime(AbsoluteTime).
public
virtual IOReturn wakeAtTimeUS( UInt32 us);
abstime
Time to wake up in microseconds.
kIOReturnSuccess if everything is fine, kIOReturnNoResources if action hasn't been declared.
Action |
public
typedef void ( *Action)( OSObject *owner, IOTimerEventSource *sender);
owner
Owning target object. Note by a startling coincidence the first parameter in a C callout is currently used to define the target of a C++ member function.
sender
The object that timed out.
'C' Function pointer defining the callout routine of this event source.
ExpansionData |
protected
struct ExpansionData { SInt32 calloutGeneration; IOWorkLoop *workLoop; };
This structure is private to the IOTimerEventSource implementation.
abstime |
protected
AbsoluteTime abstime;
calloutEntry |
protected
void *calloutEntry;
reserved |
protected
ExpansionData *reserved;
Reserved for future use. (Internal use only)
|
Last Updated: 2008-12-19