The Windows guidelines for I/O completion and cancellation require that drivers:
Support cancellation for I/O requests that might take an indefinite period of time to complete.
Complete I/O requests within a reasonable period-generally, 10 seconds or less-after cancellation.
Do not block I/O threads for an unreasonable period while performing I/O. UMDF I/O threads are a limited resource, so blocking on such a thread for a long time can decrease driver performance.
To aid user-mode drivers in conforming to these guidelines, UMDF supports adaptive time- outs. UMDF tracks the progress on critical I/O operations that can hold up the system if delayed. Critical operations include cleanup, close, cancellation, and Plug and Play and power requests.
When the reflector passes a critical request to the driver host process, it watches for progress on I/O operations. The user-mode driver must complete an operation at regular intervals until it has completed the critical request. For example, if the device is transitioning to a low-power state, the driver's callbacks must either return within a time-out period or complete any outstanding I/O requests that it cannot leave pending at regular intervals so that the reflector extends the time-out period.
If the time-out period expires, the reflector terminates the host process and reports the problem through Windows Error Reporting (WER). Currently, the default time-out is one minute. If the driver must perform operations that take a long time to complete, it should handle them asynchronously, create a separate thread to handle them, or handle them in a user work item.