This topic has not yet been rated - Rate this topic

CsqReleaseLock routine

The CsqReleaseLock routine is used by the system to release the lock that was acquired using CsqAcquireLock.

Syntax


IO_CSQ_RELEASE_LOCK CsqReleaseLock;

VOID CsqReleaseLock(
  _In_  PIO_CSQ Csq,
  _In_  KIRQL Irql
)
{ ... }

Parameters

Csq [in]

Pointer to the IO_CSQ structure for the cancel-safe IRP queue.

Irql [in]

Specifies an IRQL. This is the value stored by CsqAcquireLock when the lock was acquired.

Return value

None

Remarks

The driver specifies the CsqReleaseLock routine for a cancel-safe IRP queue when it initializes the queue's IO_CSQ structure. The driver specifies the routine as the CsqReleaseLock parameter of IoCsqInitialize or IoCsqInitializeEx when it initializes IO_CSQ. For more information, see Cancel-Safe IRP Queues.

The system calls this function to release a lock that was acquired using CsqAcquireLock.

If the driver uses a spin lock to implement locking for the queue, it must store the current IRQL when it acquires the lock, and provide the stored IRQL when it releases the lock. The CsqAcquireLock routine stores the current IRQL, and the system passes the stored value as the Irql parameter to CsqReleaseLock. Otherwise the driver can ignore the Irql parameter. For information about spin locks, see Spin Locks.

Drivers can use any locking mechanism to lock the queue, such as mutexes. For more information about mutexes, see Mutex Objects.

Examples

To define a CsqReleaseLock callback routine that is named MyCsqReleaseLock, you must first provide a function declaration that Static Driver Verifier (SDV) and other verification tools require, as shown in the following code example:


IO_CSQ_RELEASE_LOCK MyCsqReleaseLock;

Then, implement your callback routine as follows:


VOID 
 MyCsqReleaseLock(
    _In_ PIO_CSQ  Csq,
    _In_ KIRQL  Irql
    )
  {
      // Function body
  }

The IO_CSQ_RELEASE_LOCK function type is defined in the Wdm.h header file. For more information about SDV requirements for function declarations, see Declaring Functions Using Function Role Types for WDM Drivers.

Requirements

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

See also

IO_CSQ
IoCsqInitialize
IoCsqInitializeEx
IoCsqInsertIrp
IoCsqInsertIrpEx
IoCsqRemoveIrp
IoCsqRemoveNextIrp
CsqAcquireLock
CsqCompleteCanceledIrp
CsqInsertIrp
CsqInsertIrpEx
CsqPeekNextIrp
CsqRemoveIrp

 

 

Send comments about this topic to Microsoft

Build date: 5/2/2013

© 2013 Microsoft. All rights reserved.