Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

WdfIoQueueReadyNotify and recursion

James_HarperJames_Harper Member Posts: 1,615
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

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,507
    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

    Peter Viscarola
    OSR
    @OSRDrivers

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Writing WDF Drivers 21 Oct 2019 OSR Seminar Space & ONLINE
Internals & Software Drivers 18 Nov 2019 Dulles, VA
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 27 Apr 2020 OSR Seminar Space & ONLINE