ReactOS 0.4.15-dev-8096-ga0eec98
fxcallbackspinlock.hpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxCallbackSpinLock.hpp
8
9Abstract:
10
11 This is the C++ header for the FxCallbackSpinLock
12
13 This is the spinlock based driver callback lock
14
15
16Author:
17
18
19
20
21Revision History:
22
23
24--*/
25
26#ifndef _FXCALLBACKSPINLOCK_H_
27#define _FXCALLBACKSPINLOCK_H_
28
29extern "C" {
30
31#if defined(EVENT_TRACING)
32#include "FxCallbackSpinLock.hpp.tmh"
33#endif
34
35}
36
38
39private:
41
42public:
43
45 PFX_DRIVER_GLOBALS FxDriverGlobals
46 ) :
47 FxCallbackLock(FxDriverGlobals)
48 {
49 }
50
51 virtual
53 VOID
54 )
55 {
56 if (m_Verifier) {
57 delete m_Verifier;
58 }
59 }
60
61 virtual
62 void
64 FxObject* ParentObject
65 )
66 {
68
71
73
74 //
75 // VerifierLock CreateAndInitialize failure is not fatal,
76 // we just won't track anything
77 //
80 ParentObject,
81 FALSE);
82
83 }
84 }
85
86 virtual
87 void
89 __out PKIRQL PreviousIrql
90 )
91 {
93
94 if (m_OwnerThread == cur) {
96
99
100 //
101 // For now we have decided not to allow this.
102 //
103
104
105
106
107
108 //
110 "Recursive acquire of callback lock! 0x%p", this);
111
114 (ULONG_PTR) this);
115 return;
116 }
117 else {
118 if (m_Verifier != NULL) {
119 m_Verifier->Lock(PreviousIrql, FALSE);
120 }
121 else {
122 m_Lock.Acquire(PreviousIrql);
123 }
124
126 return;
127 }
128 }
129
130 virtual
131 void
133 __in KIRQL PreviousIrql
134 )
135 {
137
138 if (m_RecursionCount > 0) {
140 }
141 else {
143 if (m_Verifier != NULL) {
144 m_Verifier->Unlock(PreviousIrql, FALSE);
145 }
146 else {
147 m_Lock.Release(PreviousIrql);
148 }
149 }
150 }
151
153 inline
154 virtual
155 BOOLEAN
157 VOID
158 )
159 {
161
162 if (m_OwnerThread == cur) {
163 return TRUE;
164 }
165 else {
166 return FALSE;
167 }
168 }
169};
170
171#endif // _FXCALLBACKSPINLOCK_H_
unsigned char BOOLEAN
VOID CheckOwnership(VOID)
FxVerifierLock * m_Verifier
MxThread m_OwnerThread
virtual ~FxCallbackSpinLock(VOID)
virtual void Unlock(__in KIRQL PreviousIrql)
FxCallbackSpinLock(PFX_DRIVER_GLOBALS FxDriverGlobals)
virtual void Initialize(FxObject *ParentObject)
virtual void Lock(__out PKIRQL PreviousIrql)
virtual _Must_inspect_result_ BOOLEAN IsOwner(VOID)
VOID Unlock(__in KIRQL PreviousIrql, __in BOOLEAN AtDpc)
_Must_inspect_result_ static __inline NTSTATUS CreateAndInitialize(__out FxVerifierLock **VerifierLock, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *ParentObject, __in BOOLEAN UseMutex)
VOID Lock(__out PKIRQL PreviousIrql, __in BOOLEAN AtDpc)
Definition: mxlock.h:102
static __inline MxThread MxGetCurrentThread()
Definition: mxgeneralkm.h:61
#define __in
Definition: dbghelp.h:35
#define __out
Definition: dbghelp.h:62
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UCHAR KIRQL
Definition: env_spec_w32.h:591
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS fxDriverGlobals
FxCollectionEntry * cur
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
Definition: fxverifier.h:58
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define TRACE_LEVEL_FATAL
Definition: storswtr.h:26
PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxstump.hpp:98
BOOLEAN FxVerifierLock
Definition: fxglobals.h:451
uint32_t ULONG_PTR
Definition: typedefs.h:65
@ WDF_RECURSIVE_LOCK
Definition: wdfbugcodes.h:59