IWDFInterrupt::TryToAcquireInterruptLock method (wudfddi.h)

[Warning: UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. For more info, see Getting Started with UMDF.]

The TryToAcquireInterruptLock method acquires the interrupt lock if no other thread has already acquired it.

Syntax

BOOLEAN TryToAcquireInterruptLock();

Return value

The method returns TRUE if the interrupt lock was successfully acquired. Otherwise, the method returns FALSE.

Remarks

Unlike IWDFInterrupt::AcquireInterruptLock, IWDFInterrupt::TryToAcquireInterruptLock does not wait for the interrupt lock to become available if another thread is holding it.

When running in an arbitrary thread, such as an I/O queue callback method, drivers must call IWDFInterrupt::TryToAcquireInterruptLock instead of IWDFInterrupt::AcquireInterruptLock. For example, the driver calls IWDFInterrupt::TryToAcquireInterruptLock from IQueueCallbackRead::OnRead. Doing so avoids the possibility of deadlock, as described in the Remarks section of IWDFInterrupt::AcquireInterruptLock.

The driver must not attempt to acquire the lock recursively. If connected to the debugger, the framework introduces a breakpoint in this scenario.

For more information about manual interrupt locking, see Synchronizing Interrupt Code.

For more information about handling interrupts in UMDF drivers, see Accessing Hardware and Handling Interrupts.

Requirements

Requirement Value
End of support Unavailable in UMDF 2.0 and later.
Target Platform Desktop
Minimum UMDF version 1.11
Header wudfddi.h
DLL WUDFx.dll

See also

IWDFInterrupt

IWDFInterrupt::AcquireInterruptLock

WdfInterruptTryToAcquireLock