int = IOCompletion(func, arg )

Set a callback that will be used for handling asynchronous I/O operations.


func : callable

The function to call, as described by the EXTENSION_CONTROL_BLOCK::IOCallback method.

arg=None : object

Any object which will be supplied as an argument to the callback function.


If you call this multiple times, the previous callback will be discarded.

A reference to the callback and args are held until EXTENSION_CONTROL_BLOCK::DoneWithSession is called. If the callback function fails, DoneWithSession(HSE_STATUS_ERROR) will automatically be called and no further callbacks for the ECB will be made.