Timeout for IRPs in Manual Queue

For UMDF based Virtual Serial Driver, I am checking to implement read timeouts.

In IO Read routine, if data not available to read, IRPs are put into a manual queue using WdfRequestForwardToIoQueue. Later when data is available from backend IPC, the IRPs are fetched from manual queue and read request completes.

I am trying to check if there any way so that IRPs which are in manual queue shall be completed (may be automatically OR getting some callback notification) after some time (timeout condition).

I saw some option like:

WDF_REQUEST_SEND_OPTIONS syncReqOptions;

WDF_REQUEST_SEND_OPTIONS_INIT(
&syncReqOptions,
0
);
WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
&syncReqOptions,
WDF_REL_TIMEOUT_IN_SEC(10)
);

I tried, but did not get much details on how to use ‘syncReqOptions’ so that IRPs in manual queue got finished/timeout-out when timeout happens.

Does any one has any idea?

Thanks,
Prasanth

There’s no automatic way to do this. You need to manage your own timer. You could pass the WDF Request handle to the timer callback in the context.

Thanks!