WdfIoQueueReadyNotify and recursion

My bus driver is managing requests from two queues. One queue consists of inverted calls from usermode. The other consists of requests from the child driver. When there is a usermode request and a child request, the child request data is copied to the usermode request and the usermode request is completed.

Both queues are set to manual, and I’m using WdfIoQueueReadyNotify on both queues to call a common function that removes requests from both queues and does the magic. If one of the requests is invalid though, I need to requeue the request back onto its queue, but that is causing a recursive situation if the queue now goes from empty to non-empty.

Does stopping the queue prevent the call to the QueueReadyNotify routine, or do I need to stop the queue and then clear the QueueReadyNotify callback?

Any other suggestions as to how I could manage two queues like this would be appreciated too!

Thanks

James

You create 4 queues: Two Sequential and Two Manual.

How about having two Sequential Queues at your top edge. When you receive a Request from user-mode, you attempt to remove a Request from a manual Queue of pending Requests from the Child. If you’re successful, you complete both Requests. If you’re NOT successful, you put the user-mode Request on a manual queue of pending User-mode Requests.

Similarly, when you receive a Request from your Child, you attempt to remove a Request your Queues of pending User-Mode Requests. If you’re successful, you complete both Requests. If you’re NOT successful, you put the child Request on a manual queue of pending child Requests.

That’s the most common design pattern for “I need to satisfy A with B, as soon as both A and B are available” – Might that work for your situation?

Peter
OSR