ReactOS 0.4.15-dev-7934-g1dc8d80
FxWorkItemEventQueue Struct Reference

#include <fxeventqueue.hpp>

Inheritance diagram for FxWorkItemEventQueue:
Collaboration diagram for FxWorkItemEventQueue:

Public Member Functions

 FxWorkItemEventQueue (__in UCHAR QueueDepth)
 
 ~FxWorkItemEventQueue ()
 
_Must_inspect_result_ NTSTATUS Init (__inout FxPkgPnp *Pnp, __in PFN_PNP_EVENT_WORKER WorkerRoutine, __in PVOID WorkerContext=NULL)
 
VOID QueueToThread (VOID)
 
- Public Member Functions inherited from FxEventQueue
 FxEventQueue (__in UCHAR QueueDepth)
 
_Must_inspect_result_ NTSTATUS Initialize (__in PFX_DRIVER_GLOBALS DriverGlobals)
 
 _Acquires_lock_ (this->m_QueueLock) __drv_maxIRQL(DISPATCH_LEVEL) __drv_setsIRQL(DISPATCH_LEVEL) VOID Lock(__out __drv_deref(__drv_savesIRQL) PKIRQL Irql)
 
 _Releases_lock_ (this->m_QueueLock) __drv_requiresIRQL(DISPATCH_LEVEL) VOID Unlock(__in __drv_restoresIRQL KIRQL Irql)
 
BOOLEAN IsFull (VOID)
 
BOOLEAN IsEmpty (VOID)
 
VOID IncrementHead (VOID)
 
UCHAR GetHead (VOID)
 
UCHAR InsertAtHead (VOID)
 
UCHAR InsertAtTail (VOID)
 
UCHAR IncrementHistoryIndex (VOID)
 
BOOLEAN IsClosedLocked (VOID)
 
VOID GetFinishedState (__inout FxPostProcessInfo *Info)
 
BOOLEAN SetFinished (__in FxCREvent *Event)
 
VOID SetDelayedDeletion (VOID)
 
- Public Member Functions inherited from FxStump
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType)
 
VOID operator delete (__in PVOID pointer)
 
PVOID operator new[] (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID operator delete[] (__in PVOID pointer)
 

Protected Member Functions

VOID QueueWorkItem (VOID)
 
- Protected Member Functions inherited from FxEventQueue
VOID Configure (__in FxPkgPnp *Pnp, __in PFN_PNP_EVENT_WORKER WorkerRoutine, __in PVOID Context)
 
BOOLEAN QueueToThreadWorker (VOID)
 
VOID EventQueueWorker (VOID)
 
BOOLEAN IsIdleLocked (VOID)
 
- Protected Member Functions inherited from FxStump
 FxStump (VOID)
 

Protected Attributes

MxWorkItem m_WorkItem
 
- Protected Attributes inherited from FxEventQueue
UCHAR m_QueueHead
 
UCHAR m_QueueTail
 
UCHAR m_QueueDepth
 
UCHAR m_HistoryIndex
 
FxPkgPnpm_PkgPnp
 
PVOID m_EventWorkerContext
 
MxLock m_QueueLock
 
PFN_PNP_EVENT_WORKER m_EventWorker
 
FxCREventm_WorkItemFinished
 
union {
   UCHAR   m_QueueFlags
 
   struct {
      UCHAR   WorkItemQueued: 1
 
      UCHAR   Closed: 1
 
      UCHAR   DelayDeletion: 1
 
   }   m_QueueFlagsByName
 
}; 
 
UCHAR m_WorkItemRunningCount
 

Static Protected Attributes

static MX_WORKITEM_ROUTINE _WorkItemCallback
 

Additional Inherited Members

- Public Attributes inherited from FxEventQueue
FxWaitLockInternal m_StateMachineLock
 

Detailed Description

Definition at line 292 of file fxeventqueue.hpp.

Constructor & Destructor Documentation

◆ FxWorkItemEventQueue()

FxWorkItemEventQueue::FxWorkItemEventQueue ( __in UCHAR  QueueDepth)

Definition at line 308 of file eventqueue.cpp.

310 : FxEventQueue(QueueDepth)
311{
312}

◆ ~FxWorkItemEventQueue()

FxWorkItemEventQueue::~FxWorkItemEventQueue ( )

Definition at line 314 of file eventqueue.cpp.

315{
317}
__inline VOID Free()
Definition: mxworkitemkm.h:90

Member Function Documentation

◆ Init()

_Must_inspect_result_ NTSTATUS FxWorkItemEventQueue::Init ( __inout FxPkgPnp Pnp,
__in PFN_PNP_EVENT_WORKER  WorkerRoutine,
__in PVOID  WorkerContext = NULL 
)

Definition at line 321 of file eventqueue.cpp.

326{
328
329 Configure(Pnp, WorkerRoutine, WorkerContext);
330
331
332
333
334
335
336
337
338
339
340
343 );
344
345 if (!NT_SUCCESS(status)) {
346 return status;
347 }
348
349 return STATUS_SUCCESS;
350}
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ __inline NTSTATUS Allocate(__in MdDeviceObject DeviceObject, __in_opt PVOID ThreadPoolEnv=NULL)
Definition: mxworkitemkm.h:41
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ _In_ PFLT_CALLBACK_DATA _In_ PFLT_DEFERRED_IO_WORKITEM_ROUTINE WorkerRoutine
Definition: fltkernel.h:1977
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID Configure(__in FxPkgPnp *Pnp, __in PFN_PNP_EVENT_WORKER WorkerRoutine, __in PVOID Context)
Definition: eventqueue.cpp:77
Definition: ps.c:97
PVOID GetIoMgrObjectForWorkItemAllocation(VOID)
Definition: supportum.cpp:98

Referenced by FxPkgPnp::PostCreateDeviceInitialize().

◆ QueueToThread()

VOID FxWorkItemEventQueue::QueueToThread ( VOID  )
inline

Definition at line 308 of file fxeventqueue.hpp.

311 {
312 if (QueueToThreadWorker()) {
314 }
315 }
BOOLEAN QueueToThreadWorker(VOID)
Definition: eventqueue.cpp:154
VOID QueueWorkItem(VOID)

Referenced by FxPkgPnp::PnpProcessEvent().

◆ QueueWorkItem()

VOID FxWorkItemEventQueue::QueueWorkItem ( VOID  )
protected

Definition at line 40 of file eventqueuekm.cpp.

43{
44 //
45 // The work item will take a reference on KMDF itself. This will keep KMDF's
46 // image around (but not necessarily prevent DriverUnload from being called)
47 // so that the code after we set the done event will be in memory and not
48 // unloaded. We must do this because there is no explicit reference between
49 // the client driver and KMDF, so when the io manager calls the client's
50 // DriverUnload, it has no way of managing KMDF's ref count to stay in memory
51 // when the loader unloads KMDF explicitly in response to DriverUnload.
52 //
53 // We manually take a reference on the client so that we provide the same
54 // functionality that IO workitems do. The client driver's image will have
55 // a reference on it after it has returned.
56 //
57
58
59
60
62
63 //
64 // Prevent FxDriverGlobals from being deleted until the workitem finishes
65 // its work. In case of a bus driver with a PDO in removed
66 // state, if the bus is removed, the removal of PDO may happen in a workitem
67 // and may result in unload routine being called before the PDO package is
68 // deallocated. Since FxPool deallocation code touches FxDriverGlobals
69 // (a pointer of which is located in the header of each FxPool allocated
70 // object), taking this ref prevents the globals from going away until a
71 // corresponding deref at the end of workitem.
72 //
74
77 (FxEventQueue*) this);
78}
__inline MdDriverObject GetDriverObject(VOID)
Definition: fxdriver.hpp:252
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
__inline VOID Enqueue(__in PMX_WORKITEM_ROUTINE Callback, __in PVOID Context)
Definition: mxworkitemkm.h:58
static __inline VOID MxReferenceObject(__in PVOID Object)
Definition: mxgeneralkm.h:238
IO_WORKITEM_ROUTINE * PMX_WORKITEM_ROUTINE
Definition: mxworkitemkm.h:26
FxPkgPnp * m_PkgPnp
static MX_WORKITEM_ROUTINE _WorkItemCallback
FxDriver * Driver
Definition: fxglobals.h:374

Referenced by QueueToThread().

Member Data Documentation

◆ _WorkItemCallback

VOID FxWorkItemEventQueue::_WorkItemCallback
staticprotected

Definition at line 325 of file fxeventqueue.hpp.

Referenced by QueueWorkItem().

◆ m_WorkItem

MxWorkItem FxWorkItemEventQueue::m_WorkItem
protected

Definition at line 327 of file fxeventqueue.hpp.

Referenced by Init(), QueueWorkItem(), and ~FxWorkItemEventQueue().


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