Specifying a Callback Synchronization Mode

[This topic applies to UMDF 1.x.]

The driver can specify how its callback functions are called by the framework. The driver specifies a synchronization (or locking) mode for a device before it calls the IWDFDriver::CreateDevice method to create a device object for the device. To specify synchronization mode, the driver should call the IWDFDeviceInitialize::SetLockingConstraint method. The driver receives a pointer to the IWDFDeviceInitialize interface when its IDriverEntry::OnDeviceAdd method is called to add the device to the system.

The driver can specify one of the following values from the WDF_CALLBACK_CONSTRAINT enumeration type in the LockType parameter of IWDFDeviceInitialize::SetLockingConstraint to identify the locking mode. The type of constraint (or locking) specified depends on how much parallelism the hardware device can exploit and how much the driver can handle.

ValueMeaning

None (0)

Indicates that no callback functions into the driver are synchronized.

WdfDeviceLevel (1)

Indicates that all queue callback functions into the driver are synchronized.

 

Note   If the driver does not call IWDFDeviceInitialize::SetLockingConstraint to specify a value, the framework sets the default value of this property to WdfDeviceLevel.

Constraints apply only to queue callback functions and not to Plug and Play (PnP) and power management callback functions. Queue callback functions include the following:

Request completion callback functions (IRequestCallbackRequestCompletion::OnCompletion) are not queue callback functions. Therefore, they are not synchronized.

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft