IoAcquireCancelSpinLock

VOID
    IoAcquireCancelSpinLock(

        OUT PKIRQL  Irql
        );

IoAcquireCancelSpinLock synchronizes cancelable-state transitions for IRPs in a multiprocessor-safe way.

Parameters

Irql
Points to a variable in which to save the current IRQL for a subsequent call to IoReleaseCancelSpinLock. Usually, the Irql is saved on the stack as a local variable.

Comments

A driver that uses the I/O-manager-supplied device queues in the device object must be holding the cancel spin lock whenever it changes the cancelable state of an IRP with IoSetCancelRoutine.

A driver that manages its own queue(s) of IRPs does not need to hold the cancel spin lock when calling IoSetCancelRoutine.

The holder of the cancel spin lock should release it promptly by calling IoReleaseCancelSpinLock.

A driver-supplied Cancel routine is called with the cancel spin lock held. It must release the cancel spin lock when it has completed the IRP to be cancelled.

Callers of IoAcquireCancelSpinLock must be running at IRQL <= DISPATCH_LEVEL.

See Also

IoReleaseCancelSpinlock, IoSetCancelRoutine