WdfSpinLockAcquire method
[Applies to KMDF and UMDF]
The WdfSpinLockAcquire method acquires a specified spin lock.
Syntax
VOID WdfSpinLockAcquire(
_In_ WDFSPINLOCK SpinLock
);
Parameters
- SpinLock [in]
A handle to a framework spin-lock object, obtained by a previous call to WdfSpinLockCreate.
Return value
None.
A bug check occurs if the driver supplies an invalid object handle.
Remarks
The WdfSpinLockAcquire method returns after the specified spin lock has been acquired. For KMDF, the method returns at IRQL = DISPATCH_LEVEL. For UMDF, the method returns at passive.
Your driver cannot call WdfSpinLockAcquire to acquire a spin lock that the driver has specified in a WDF_INTERRUPT_CONFIG structure.
For more information about spin locks, see Synchronization Techniques for Framework-Based Drivers.
Examples
The following code example is part of an EvtInterruptDpc callback function from the PCIDRV sample driver. The example acquires a spin lock, calls a routine that processes received packets, and releases the spin lock.
VOID
NICEvtInterruptDpc(
IN WDFINTERRUPT WdfInterrupt,
IN WDFOBJECT WdfDevice
)
{
...
WdfSpinLockAcquire(fdoData->RcvLock);
NICHandleRecvInterrupt(fdoData);
WdfSpinLockRelease(fdoData->RcvLock);
...
}
Requirements
Target platform |
Universal |
Minimum KMDF version |
1.0 |
Minimum UMDF version |
2.0 |
Header |
Wdfsync.h (include Wdf.h) |
Library |
Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF) |
IRQL |
<=DISPATCH_LEVEL |
DDI compliance rules |
DriverCreate, KmdfIrql, KmdfIrql2, ReqSendWhileSpinlock, WdfSpinlock, WdfSpinlockRelease |
See also