Mailing Lists: Apple Mailing Lists

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

IOUserClient Asynchronous I/O and Work Loops



I'm relatively new to IOKit drivers, and after reading through the I/O Kit Device Driver Design Guidelines and SimpleUserClient example, I have a few questions about asynchronous I/O with the IOUserClient.

After IOConnectSetNotificationPort has triggered IOUserClient::registerNotificationPort and a request is later issued to the kernel with an IOAsyncCallback, does the call immediately return to the application automatically (like WDM), or do I need to return from the method as usual? If I need to return as usual, then I apparently need to start my long-running I/O (e.g. a USB transfer with a completion callback) and then in that completion get my IOUserClient to call sendAsyncResult. In this case, complicated asynchronous operations or PIO don't seem to be options.

Would it be more appropriate to use an IOCommandGate to pass the asynchronous request to a work loop? The work loop documentation in I/ O Kit Fundamentals seems to indicate that event handlers should not perform time consuming work, which is at odds with that idea.

Another idea is to spawn a thread to perform the asynchronous I/O.

I haven't been able to find an example of a driver using asynchronous I/O. If anyone can point me to one that applies best practices, that would be really helpful.

Thanks,

Dan Wilson
_______________________________________________
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.