- if (doit) {
- IOTimeStampConstant(IODBG_TIMES(IOTIMES_ACTION),
- (unsigned int) doit, (unsigned int) me->owner);
- me->closeGate();
- (*doit)(me->owner, me);
- me->openGate();
+void IOTimerEventSource::timeoutAndRelease(void * self, void * c)
+{
+ IOTimerEventSource *me = (IOTimerEventSource *) self;
+ /* The second parameter (a pointer) gets abused to carry an SInt32, so on LP64, "count"
+ must be cast to "long" before, in order to tell GCC we're not truncating a pointer. */
+ SInt32 count = (SInt32) (long) c;
+
+ IOStatisticsTimeout();
+
+ if (me->enabled && me->action)
+ {
+ IOWorkLoop *
+ wl = me->reserved->workLoop;
+ if (wl)
+ {
+ Action doit;
+ wl->closeGate();
+ IOStatisticsCloseGate();
+ doit = (Action) me->action;
+ if (doit && (me->reserved->calloutGeneration == count))
+ {
+ bool trace = (gIOKitTrace & kIOTraceTimers) ? true : false;
+
+ if (trace)
+ IOTimeStampStartConstant(IODBG_TIMES(IOTIMES_ACTION),
+ VM_KERNEL_UNSLIDE(doit), (uintptr_t) me->owner);
+
+ (*doit)(me->owner, me);
+#if CONFIG_DTRACE
+ DTRACE_TMR3(iotescallout__expire, Action, doit, OSObject, me->owner, void, me->workLoop);
+#endif
+
+ if (trace)
+ IOTimeStampEndConstant(IODBG_TIMES(IOTIMES_ACTION),
+ VM_KERNEL_UNSLIDE(doit), (uintptr_t) me->owner);
+ }
+ IOStatisticsOpenGate();
+ wl->openGate();