#include <mach/sdt.h>
#endif
+#include <libkern/Block.h>
+
+
#define super IOEventSource
OSDefineMetaClassAndStructors(IOTimerEventSource, IOEventSource)
OSMetaClassDefineReservedUsed(IOTimerEventSource, 0);
// the timeout interval expires.
//
-static __inline__ void
-InvokeAction(IOTimerEventSource::Action action, IOTimerEventSource * ts,
+__inline__ void
+IOTimerEventSource::invokeAction(IOTimerEventSource::Action action, IOTimerEventSource * ts,
OSObject * owner, IOWorkLoop * workLoop)
{
bool trace = (gIOKitTrace & kIOTraceTimers) ? true : false;
IOTimeStampStartConstant(IODBG_TIMES(IOTIMES_ACTION),
VM_KERNEL_ADDRHIDE(action), VM_KERNEL_ADDRHIDE(owner));
- (*action)(owner, ts);
+ if (kActionBlock & flags) ((IOTimerEventSource::ActionBlock) actionBlock)(ts);
+ else (*action)(owner, ts);
#if CONFIG_DTRACE
DTRACE_TMR3(iotescallout__expire, Action, action, OSObject, owner, void, workLoop);
doit = (Action) me->action;
if (doit && me->enabled && AbsoluteTime_to_scalar(&me->abstime))
{
- InvokeAction(doit, me, me->owner, me->workLoop);
+ me->invokeAction(doit, me, me->owner, me->workLoop);
}
IOStatisticsOpenGate();
wl->openGate();
doit = (Action) me->action;
if (doit && (me->reserved->calloutGeneration == count))
{
- InvokeAction(doit, me, me->owner, me->workLoop);
+ me->invokeAction(doit, me, me->owner, me->workLoop);
}
IOStatisticsOpenGate();
wl->openGate();
&& enabled && (doit = (Action) action))
{
reserved->calloutGenerationSignaled = ~reserved->calloutGeneration;
- InvokeAction(doit, this, owner, workLoop);
+ invokeAction(doit, this, owner, workLoop);
}
return false;
return me;
}
+IOTimerEventSource *
+IOTimerEventSource::timerEventSource(uint32_t options, OSObject *inOwner, ActionBlock action)
+{
+ IOTimerEventSource * tes;
+ tes = IOTimerEventSource::timerEventSource(options, inOwner, (Action) NULL);
+ if (tes) tes->setActionBlock((IOEventSource::ActionBlock) action);
+
+ return tes;
+}
+
#define _thread_call_cancel(tc) ((kActive & flags) ? thread_call_cancel_wait((tc)) : thread_call_cancel((tc)))
IOTimerEventSource *
AbsoluteTime abstime, AbsoluteTime leeway)
{
AbsoluteTime end;
- clock_continuoustime_interval_to_deadline(abstime, &end);
- return wakeAtTime(options, end, leeway);
+ if (options & kIOTimeOptionsContinuous)
+ clock_continuoustime_interval_to_deadline(abstime, &end);
+ else
+ clock_absolutetime_interval_to_deadline(abstime, &end);
+ return wakeAtTime(options, end, leeway);
}
IOReturn IOTimerEventSource::wakeAtTimeTicks(UInt32 ticks)