WdfWorkItemFlush メソッド

The WdfWorkItemFlush method returns after a specified work item has been serviced.

構文

VOID WdfWorkItemFlush(
  [in]  WDFWORKITEM WorkItem
);

パラメーター

WorkItem [in]

A handle to a framework work-item object that is obtained from a previous call to WdfWorkItemCreate.

戻り値

None.

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

解説

If your driver calls the WdfWorkItemFlush method, the method does not return until a system worker thread has removed the specified work item from the work-item queue and called the driver's EvtWorkItem callback function, and the EvtWorkItem callback function has subsequently returned after processing the work item.

Most drivers that use work items do not need to call WdfWorkItemFlush. A driver might call WdfWorkItemFlush if it must synchronize completion of work items with the removal of a remote I/O target. In this case, the driver can call WdfWorkItemFlush from within its EvtIoTargetQueryRemove callback function.

For more information about work items, see Using Framework Work Items.

The following code example is an EvtIoTargetQueryRemove callback function from the Toaster sample driver.

NTSTATUS
ToastMon_EvtIoTargetQueryRemove(
    WDFIOTARGET IoTarget
)
{
    PTARGET_DEVICE_INFO  targetDeviceInfo = NULL;
    //
    // Get the I/O target object's context.
    //
    targetDeviceInfo = GetTargetDeviceInfo(IoTarget);
    //
    // Ensure that the I/O target's work item
    // has been processed before closing the target.
    //
    WdfWorkItemFlush(targetDeviceInfo->WorkItem);
    WdfIoTargetCloseForQueryRemove(IoTarget);

    return STATUS_SUCCESS;
}

要件

バージョン

Available in version 1.0 and later versions of KMDF.

ヘッダー

Wdfworkitem.h (includeWdf.h)

ライブラリ

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

IRQL

PASSIVE_LEVEL

参照

EvtWorkItem

 

 

コミュニティの追加

追加
表示:
© 2015 Microsoft