ReactOS 0.4.15-dev-8109-gd7be748
fxdisposelist.hpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxDisposalList.hpp
8
9Abstract:
10
11 This class implements a Disposal list for deferring Dispose
12 processing from dispatch to passive level.
13
14Author:
15
16
17
18
19
20
21Environment:
22
23 Both kernel and user mode
24
25Revision History:
26
27
28--*/
29
30#ifndef _FXDISPOSELIST_H_
31#define _FXDISPOSELIST_H_
32
33/*
34 * Some objects can perform dispose/cleanup processing at DISPATCH_LEVEL,
35 * and must defer cleanup processing to PASSIVE_LEVEL.
36 *
37 * This is either due to use of page-able data or code, or a passive
38 * level callback constraint on the object.
39 *
40 * This class supports this by providing a list to enqueue objects on
41 * that need dispose, and an event that may be used by a calling thread
42 * such as the Pnp DeviceRemove thread that must synchronize all object
43 * rundown associated with an FxDevice before returning.
44 *
45 * This is designed to operate in an allocation free manner, and re-uses
46 * an FxObject entry that is not longer in use when an object is in
47 * a deferred dispose state.
48 *
49 */
50
52
53private:
54
55 //
56 // The List of items to cleanup
57 //
59
60 //
61 // Pointer to the end of the list so appending does not require traversal
62 // of the entire list
63 //
65
66 //
67 // This is a pointer to thread object that invoked our workitem
68 // callback. This value will be used to avoid deadlock when we try
69 // to flush the workitem.
70 //
72
74
75 //
76 // WDM PDRIVER or PDEVICE_OBJECT for allocating PIO_WORKITEMS
77 //
79
80private:
81 static
82 VOID
85 );
86
87 VOID
89 PKIRQL PreviousIrql
90 );
91
92 virtual
94 Dispose(
95 VOID
96 );
97
98public:
99
100 static
102 _Create(
103 PFX_DRIVER_GLOBALS FxDriverGlobals,
104 PVOID WdmObject,
106 );
107
109 PFX_DRIVER_GLOBALS FxDriverGlobals
110 );
111
113 );
114
117 PVOID wdmObject
118 );
119
120 //
121 // Add an object to the list.
122 //
123 // The object's m_DisposeListEntry is used and must be initialized
124 //
125 VOID
126 Add(
127 FxObject* object
128 );
129
130 //
131 // Waits until the list is empty
132 //
133 VOID
135 VOID
136 );
137
139};
140
141#endif // _FXDISPOSELIST_H_
142
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
VOID DrainListLocked(PKIRQL PreviousIrql)
static VOID _WorkItemThunk(__in PVOID Parameter)
static NTSTATUS _Create(PFX_DRIVER_GLOBALS FxDriverGlobals, PVOID WdmObject, FxDisposeList **pObject)
VOID WaitForEmpty(VOID)
DECLARE_INTERNAL_NEW_OPERATOR()
MxThread m_WorkItemThread
virtual BOOLEAN Dispose(VOID)
SINGLE_LIST_ENTRY ** m_ListEnd
FxSystemWorkItem * m_SystemWorkItem
VOID Add(FxObject *object)
SINGLE_LIST_ENTRY m_List
#define __in
Definition: dbghelp.h:35
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
FxObject * pObject
Definition: ntbasedef.h:628
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:323
static void Initialize()
Definition: xlate.c:212