ReactOS  0.4.15-dev-2701-g34593d9
MxWorkItem Class Reference

#include <mxworkitem.h>

Inheritance diagram for MxWorkItem:
Collaboration diagram for MxWorkItem:

Public Member Functions

__inline MxWorkItem ()
 
VOID WaitForCallbacksToComplete (VOID)
 
_Must_inspect_result_ __inline NTSTATUS Allocate (__in MdDeviceObject DeviceObject, __in_opt PVOID ThreadPoolEnv=NULL)
 
__inline VOID Enqueue (__in PMX_WORKITEM_ROUTINE Callback, __in PVOID Context)
 
__inline MdWorkItem GetWorkItem ()
 
__inline VOID Free ()
 
__inline ~MxWorkItem ()
 

Static Public Member Functions

static VOID CALLBACK _WorkerThunk (_Inout_ PTP_CALLBACK_INSTANCE Instance, _Inout_opt_ PVOID Parameter, _Inout_ PTP_WAIT Wait, _In_ TP_WAIT_RESULT WaitResult)
 
static __inline VOID _Free (__in MdWorkItem Item)
 

Protected Attributes

MdWorkItem m_WorkItem
 

Detailed Description

Definition at line 28 of file mxworkitem.h.

Constructor & Destructor Documentation

◆ MxWorkItem()

__inline MxWorkItem::MxWorkItem ( )

Definition at line 32 of file mxworkitemkm.h.

34 {
35  m_WorkItem = NULL;
36 }
MdWorkItem m_WorkItem
Definition: mxworkitem.h:32
#define NULL
Definition: types.h:112

◆ ~MxWorkItem()

__inline MxWorkItem::~MxWorkItem ( )
inline

Definition at line 95 of file mxworkitem.h.

97  {
98  }

Member Function Documentation

◆ _Free()

__inline VOID MxWorkItem::_Free ( __in MdWorkItem  Item)
static

Definition at line 81 of file mxworkitemkm.h.

84 {
86 }
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
_In_ WDFCOLLECTION _In_ WDFOBJECT Item

Referenced by FxPkgPdo::_QueryCapsWorkItem(), and Free().

◆ _WorkerThunk()

VOID CALLBACK MxWorkItem::_WorkerThunk ( _Inout_ PTP_CALLBACK_INSTANCE  Instance,
_Inout_opt_ PVOID  Parameter,
_Inout_ PTP_WAIT  Wait,
_In_ TP_WAIT_RESULT  WaitResult 
)
static

Definition at line 30 of file mxworkitemum.cpp.

36 {
37  MdWorkItem workItem = (MdWorkItem) Parameter;
38 
41  UNREFERENCED_PARAMETER(WaitResult);
42 
43  (*workItem->Callback)(
44  workItem->DeviceObject,
45  workItem->Context
46  );
47 
48  return;
49 }
PVOID Context
Definition: io.h:311
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
_In_ PVOID Parameter
Definition: ldrtypes.h:241
PDEVICE_OBJECT DeviceObject
Definition: io.h:309
PIO_WORKITEM MdWorkItem
Definition: mxworkitemkm.h:27
IN PVOID Instance
Definition: pci.h:361

◆ Allocate()

_Must_inspect_result_ __inline NTSTATUS MxWorkItem::Allocate ( __in MdDeviceObject  DeviceObject,
__in_opt PVOID  ThreadPoolEnv = NULL 
)

Definition at line 41 of file mxworkitemkm.h.

45 {
46  UNREFERENCED_PARAMETER(ThreadPoolEnv);
47 
49  if (NULL == m_WorkItem) {
51  }
52 
53  return STATUS_SUCCESS;
54 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
MdWorkItem m_WorkItem
Definition: mxworkitem.h:32
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by FxWorkItemEventQueue::Init(), FxThreadedEventQueue::Init(), FxWorkItem::Initialize(), FxSystemWorkItem::Initialize(), FxPkgPnp::PnpDeviceUsageNotification(), and FxPkgPdo::PnpQueryCapabilities().

◆ Enqueue()

__inline VOID MxWorkItem::Enqueue ( __in PMX_WORKITEM_ROUTINE  Callback,
__in PVOID  Context 
)

Definition at line 58 of file mxworkitemkm.h.

62 {
64  m_WorkItem,
65  Callback,
67  Context
68  );
69 }
MdWorkItem m_WorkItem
Definition: mxworkitem.h:32
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
Definition: iowork.c:40

Referenced by FxSystemWorkItem::EnqueueWorker(), FxPkgPdo::PnpQueryCapabilities(), FxWorkItemEventQueue::QueueWorkItem(), and FxThreadedEventQueue::QueueWorkItem().

◆ Free()

__inline VOID MxWorkItem::Free ( )

Definition at line 90 of file mxworkitemkm.h.

92 {
93  if (NULL != m_WorkItem) {
95  m_WorkItem = NULL;
96  }
97 }
MdWorkItem m_WorkItem
Definition: mxworkitem.h:32
static __inline VOID _Free(__in MdWorkItem Item)
Definition: mxworkitemkm.h:81
#define NULL
Definition: types.h:112

Referenced by FxSystemWorkItem::~FxSystemWorkItem(), FxThreadedEventQueue::~FxThreadedEventQueue(), FxWorkItem::~FxWorkItem(), FxWorkItemEventQueue::~FxWorkItemEventQueue(), and MxAutoWorkItem::~MxAutoWorkItem().

◆ GetWorkItem()

◆ WaitForCallbacksToComplete()

VOID MxWorkItem::WaitForCallbacksToComplete ( VOID  )

Definition at line 52 of file mxworkitemum.cpp.

55 {
56  Mx::MxAssert(NULL != m_WorkItem->WaitBlock);
57 
58  //
59  // Wait for outstanding callbacks to complete.
60  //
61  WaitForThreadpoolWaitCallbacks(m_WorkItem->WaitBlock,
62  FALSE // donot cancel pending waits
63  );
64 
65 }
MdWorkItem m_WorkItem
Definition: mxworkitem.h:32
static __inline VOID MxAssert(__in BOOLEAN Condition)
Definition: mxgeneralkm.h:165
#define FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112

Member Data Documentation

◆ m_WorkItem

MdWorkItem MxWorkItem::m_WorkItem
protected

The documentation for this class was generated from the following files: