ReactOS 0.4.16-dev-122-g325d74c
fxlock.hpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxLock.hpp
8
9Abstract:
10
11 This is the C++ header for the FxLock
12
13 This represents a container for handling locking
14
15Author:
16
17
18
19
20Revision History:
21
22
23--*/
24
25#ifndef _FXLOCK_H_
26#define _FXLOCK_H_
27
48class FxLock {
49
50private:
52
53 // For Verifier
55
56public:
58 VOID
59 )
60 {
61
62
63
64
67 }
68
69 VOID
71 __in FxObject * ParentObject
72 );
73
75 {
76 if (m_Verifier != NULL) {
77 delete m_Verifier;
78 }
79 }
80
81 _When_(this->m_Verifier == NULL, _Acquires_lock_(this->m_lock))
82 inline
83 VOID
84 Lock(
85 __out PKIRQL PreviousIrql
86 )
87 {
88 if (m_Verifier != NULL) {
89 m_Verifier->Lock(PreviousIrql, FALSE);
90 }
91 // else if (PreviousIrql == NULL) {
92 // KeAcquireSpinLockAtDpcLevel(&m_lock);
93 // }
94 else {
95 m_lock.Acquire(PreviousIrql);
96 }
97 }
98
99 _When_(this->m_Verifier == NULL, _Releases_lock_(this->m_lock))
100 inline
101 void
102 Unlock(
103 __in KIRQL PreviousIrql
104 )
105 {
106 if (m_Verifier != NULL) {
107 m_Verifier->Unlock(PreviousIrql, FALSE);
108 }
109 // else if (AtDpc) {
110 // KeReleaseSpinLockFromDpcLevel(&m_lock);
111 // }
112 else {
113 m_lock.Release(PreviousIrql);
114 }
115 }
116
117 _When_(this->m_Verifier == NULL, _Acquires_lock_(this->m_lock))
118 inline
119 VOID
120 LockAtDispatch(
121 VOID
122 )
123 {
124 if (m_Verifier != NULL) {
125 KIRQL previousIrql;
126
127 m_Verifier->Lock(&previousIrql, TRUE);
128 }
129 else {
130 m_lock.AcquireAtDpcLevel();
131 }
132 }
133
134 _When_(this->m_Verifier == NULL, _Releases_lock_(this->m_lock))
135 inline
136 void
137 UnlockFromDispatch(
138 VOID
139 )
140 {
141 if (m_Verifier != NULL) {
143 }
144 else {
145 m_lock.ReleaseFromDpcLevel();
146 }
147 }
148};
149
150#endif // _FXLOCK_H_
_When_(this->m_Verifier==NULL, _Acquires_lock_(this->m_lock)) inline VOID Lock(__out PKIRQL PreviousIrql)
Definition: fxlock.hpp:81
_When_(this->m_Verifier==NULL, _Acquires_lock_(this->m_lock)) inline VOID LockAtDispatch(VOID)
Definition: fxlock.hpp:117
MxLock m_lock
Definition: fxlock.hpp:51
FxVerifierLock * m_Verifier
Definition: fxlock.hpp:54
_When_(this->m_Verifier==NULL, _Releases_lock_(this->m_lock)) inline void Unlock(__in KIRQL PreviousIrql)
Definition: fxlock.hpp:99
FxLock(VOID)
Definition: fxlock.hpp:57
~FxLock()
Definition: fxlock.hpp:74
_When_(this->m_Verifier==NULL, _Releases_lock_(this->m_lock)) inline void UnlockFromDispatch(VOID)
Definition: fxlock.hpp:134
VOID Unlock(__in KIRQL PreviousIrql, __in BOOLEAN AtDpc)
VOID Lock(__out PKIRQL PreviousIrql, __in BOOLEAN AtDpc)
__inline VOID Initialize()
Definition: mxlockkm.h:43
Definition: mxlock.h:102
#define _Acquires_lock_(lock)
#define _Releases_lock_(lock)
#define __in
Definition: dbghelp.h:35
#define __out
Definition: dbghelp.h:62
#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
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
@ Unlock
Definition: ntsecapi.h:294
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
static void Initialize()
Definition: xlate.c:212