Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Regarding IOTimerEventSource Behavior



What exactly is the prototype for timeoutOccurred?
This is the code fragment from the timer event source callout
     (*doit)(me->owner, me);
doit is a pointer to a function
me is the pointer to the IOTimerEventSource
me->owner is your 'this' pointer.

Hi Godfrey -

It appears that what's coming back is the IOTimerEventSource*.

I was expecting a ptr to 'this' but I can certainly use a comparison
of the IOTimerEventSource* that is sent in to see if it matches the
one I created - thus confirming the source of the timeout.

As you can see from the SNIPs below - I tried two different prototypes
and got the same results for both: the first arg being the one in which
I am interested.

After running these tests multiple times and getting consistent results
I am still scratching my head when comparing what I am seeing to your
explanation of what is happening.  If you can shed any light as to
why the discrepancy exists, that would be great.

Your interest in my question is very much appreciated.  Best Regards,

Lance Drake

/ /----------------------------------------------------------------------- -----

FOR REFERENCE:
mWorkLoop = (IOWorkLoop*)getWorkLoop();
IOTimerEventSource::Action callback = (IOTimerEventSource::Action)&MY_CLASS_NAME::timeoutOccurred;
mTimerSource = IOTimerEventSource::timerEventSource(this, callback);
mWorkLoop->addEventSource(mTimerSource)


// ------------------------------------------------------------------------ -
PROTOTYPE STYLE #1


EARLIER:	Acquire IOWorkLoop* of 0x02D06240
		Create  IOEventTimerSource* mTimerSource of 0x037D7940

MY_CLASS_NAME::timeoutOccurred(OSObject *owner, IOTimerEventSource *sender)
{
...
}


RESULTS IN SYSLOG: After a one minute timeout sequence
May 26 22:59:31 localhost kernel: com_my_text_kext: mTimerSource->setTimeoutMS()
May 26 23:00:31 localhost kernel: com_my_text_kext: timeoutOccurred:
owner = 0x037D7940, (== mTimerSource)
sender = 0x00000000,
this = 0x02E90000,


// ------------------------------------------------------------------------

PROTOTYPE STYLE #2
MY_CLASS_NAME::timeoutOccurred(IOTimerEventSource *sender)
{
...
}

EARLIER: Acquire IOWorkLoop* of 0x02D3D100
Create IOEventTimerSource* mTimerSource of 0x037B8BC0
May 26 23:28:54 localhost kernel: com_my_text_kext: mTimerSource->setTimeoutMS()
May 26 23:29:54 localhost kernel: com_my_text_kext: timeoutOccurred:
sender = 0x037B8BC0 (== mTimerSource)
this = 0x02E94000


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.