信息
您所需的主题如下所示。但此主题未包含在此库中。

WdfObjectAcquireLock 方法

The WdfObjectAcquireLock method acquires an object's synchronization lock.

语法

VOID WdfObjectAcquireLock(
  [in]  WDFOBJECT Object
);

参数

Object [in]

A handle to a framework device object or a framework queue object.

返回值

None.

A bug check occurs if the driver supplies an invalid object handle.

评论

A driver can call the WdfObjectAcquireLock method to acquire the synchronization lock that is associated with a specified framework device object or framework queue object. The method does not return until the lock has been acquired.

When the driver no longer needs the object's synchronization lock, it must call WdfObjectReleaseLock.

If the driver specified WdfExecutionLevelPassive for the ExecutionLevel member of the specified object's WDF_OBJECT_ATTRIBUTES structure, the driver must call WdfObjectAcquireLock at IRQL <= APC_LEVEL. WdfObjectAcquireLock acquires a fast mutex and returns at the caller's IRQL. (In this case, WdfObjectAcquireLock also calls KeEnterCriticalRegion before returning so that normal kernel APCs are disabled.)

If the driver did not specify WdfExecutionLevelPassive for the ExecutionLevel member of the specified object's WDF_OBJECT_ATTRIBUTES structure, the driver must call WdfObjectAcquireLock at IRQL <= DISPATCH_LEVEL. WdfObjectAcquireLock acquires a spin lock and returns at IRQL = DISPATCH_LEVEL.

For more information about synchronization locks, see Synchronization Techniques for Framework-Based Drivers.

示例

The following code example acquires an object's synchronization lock. The driver previously obtained the object handle by calling WdfDeviceCreate or WdfIoQueueCreate.

WdfObjectAcquireLock(Object);

要求

版本

Available in version 1.0 and later versions of KMDF.

标头

Wdfsync.h (包括Wdf.h)

Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)

IRQL

See Remarks section.

另请参见

KeEnterCriticalRegion
WDF_OBJECT_ATTRIBUTES
WdfObjectReleaseLock

 

 

社区附加资源

显示:
© 2014 Microsoft