Mailing Lists: Apple Mailing Lists

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

Re: IOTimerEventSource behavior



The answer depends on what type of function timeoutOccured is.

Action is defined as

typedef void (*Action)(OSObject *owner, IOTimerEventSource *sender);

1> It is a static member function. In this case the owner and sender arguments are what you would expect.
2> You are using a normal member function or virtual member function. In this case the owner argument is passed to you in the 'this' pointer. Eg
virtual void timeoutOccurred(IOTimerEventSource *sender) is the correct declaration and you use OSCastMemberFunction to convert it into a IOTimerEventSource::Action, then in your


void MY_CLASS_NAME::(IOTimerEventSource *sender)
{
#if DEBUG
    if (!OSDynamicCast(MY_CLASS_NAME, this))
        ; // We have a problem log it.
#endif
}

Godfrey

On 05/25/2005, at 11:40 , Lance Drake wrote:

With regards the sample code offered for 'IOTimerEventSource behavior', I tried making use of it in my KEXT but the behavior is confusing.

SETUP FOR TIMER:
IOTimerEventSource::Action callback = (IOTimerEventSource::Action) &MY_CLASS_NAME::timeoutOccurred;
mTimerSource = IOTimerEventSource::timerEventSource(this, callback);


CALLBACK ACTIVITY:
MY_CLASS_NAME*  theOwner;

theOwner = OSDynamicCast( MY_CLASS_NAME, owner);
if(NULL != theOwner)
    {
    // never get here
    }

QUESTION:  Why doesn't the OSDynamicCast work as expected?

Thanks for your suggestions.

Lance Drake

// --------------------------------------------------
REFERENCE = Here's what's showing up in the log file:

1) Enable a timeout...
May 25 12:19:45 localhost kernel: com_my_driver_testcode: mTimerSource->setTimeoutMS()


2) 9 seconds later - enable again
May 25 12:19:54 localhost kernel: com_my_driver_testcode: mTimerSource->setTimeoutMS()


3) Not sure where this call to the timeout handler came from...
May 25 12:20:01 localhost kernel: com_my_driver_testcode:
    timeoutOccurred: theOwner came back NULL from OSDynamicCast()
    owner = 0x02FA6880, this = 0x02E81000

4) Where's the call to the handler expected at :45? - is it superceded by timeout call at :54 ?

5) This is the expected timeout from the latter call -
   but it does not appear to be from 'me'
May 25 12:20:54 localhost kernel: com_my_driver_testcode:
    timeoutOccurred: 'theOwner' came back NULL from OSDynamicCast()
    owner = 0x03752400, this = 0x02E81000

_______________________________________________
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


_______________________________________________ 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
References: 
 >IOTimerEventSource behavior (From: Lance Drake <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.