opensubscriber
   Find in this group all groups
 
Unknown more information…

d : darwin-drivers@lists.apple.com 18 November 2005 • 3:00AM -0500

Re: command
by Mike Smith

REPLY TO AUTHOR
 
REPLY TO GROUP





On Nov 16, 2005, at 1:47 AM, Shyam Sundar wrote:

> Hi All,
>
>     Can someone clarify the way the commandSleep function works for  
> IOCommandGate.
>    According to the document (both Xcode help and the Description  
> in the Source), the following steps occur when commandSleep is called:
>
>    OpenGate() is called
>    Thread goes to sleep waiting for an Event
>
>    on Event
>    CloseGate()
>    return to the thread context.
>
>     Looking at the Source Code, commandSleep makes a call to  
> IOEventSource's sleepGate  which in turn calls IOWorkloop's  
> sleepGate and it returns IORecursiveLockSleep().
> Where is the OpenGate or a counterpart Implemented ?
> In this process, is the OpenGate and the Sleep operation atomic (it  
> does not seem to be the case). If its not atomic, wouldn't it be  
> vulnerable to a context switch in     be! tween, causing a  
> situation where a CommandWakeup is called before the sleep happens !

The mechanism is explicitly designed to prevent this race, and it is  
why you are not seeing the OpenGate operation at that level. The  
actual lock operation is performed at a much lower level.

> What would be the best way to implement a commandSleep for a sub-
> Class of IOEventSource without the above problems.

Which problems?

  = Mike

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

This email sent to subscriber@open...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

opensubscriber is not affiliated with the authors of this message nor responsible for its content.