Handling Asynchronous Operations
As we will see in our later discussion of IOUSBLib classes, many methods perform operations that complete asynchronously. All such asynchronous methods take two parameters, a pointer to a callback function and a parameter named “refcon
” that allows the application to pass an arbitrary context value to its callback. The callback function has the following signature:
void MyCallbackFunction (void* refcon, IOReturn result, void* arg0);
The first parameter, refcon
, is the application's arbitrary context parameter. The second parameter reports the overall result of the operation; a value of kIOReturnSuccess
indicates the operation completed successfully. The final argument, arg0
, is provided by the IOUSBLib and ...
Get OS X and iOS Kernel Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.