Freigeben über


I/O Queues and You

I got an interesting question via mail recently, “Do I really need to create a queue object in my UMDF driver?”  Well, this is another one of those, “only if” type questions.

For instance - Only if your driver is not handling any I/O from a top edge method which results in the I/O manager being involved in talking to the UMDF driver for those operations.  At that point you don’t need to create a queue object. 

Example -

The UMDF driver wants to send I/O to a KM driver in another stack based on some form of simple event being raised and consumed by the UMDF device.  Provided you have a handle open to that KM stack and have created the I/O target object (all shown here) you can simply create and format a request, and then send that request to the target.

Should you want to send requests asynchronously and need a completion callback, you can still do so with out requiring a queue.  The driver will have to implement a IRequestCallbackRequestCompletion::OnCompletion method.  And during the packing of the request to submit, invoke the request’s SetCompletionCallback prior to invoking the FormatRequestxxx method.

Once the lower driver has completed the request, the OnCompletion method will be invoked.  Voilà.

There’s one little caveat around UMDF completion routines that I talked about a while ago and I should bring it up here; you can only define one OnCompetion method per device object.