ReactOS 0.4.16-dev-91-g764881a
FxLock Class Reference

#include <fxlock.hpp>

Collaboration diagram for FxLock:

Public Member Functions

 FxLock (VOID)
 
VOID Initialize (__in FxObject *ParentObject)
 
 ~FxLock ()
 
 _When_ (this->m_Verifier==NULL, _Acquires_lock_(this->m_lock)) inline VOID Lock(__out PKIRQL PreviousIrql)
 
 _When_ (this->m_Verifier==NULL, _Releases_lock_(this->m_lock)) inline void Unlock(__in KIRQL PreviousIrql)
 
 _When_ (this->m_Verifier==NULL, _Acquires_lock_(this->m_lock)) inline VOID LockAtDispatch(VOID)
 
 _When_ (this->m_Verifier==NULL, _Releases_lock_(this->m_lock)) inline void UnlockFromDispatch(VOID)
 

Private Attributes

MxLock m_lock
 
FxVerifierLockm_Verifier
 

Detailed Description

This is the base lock object implementation

This is intended to be embedded in an FxNonPagedObject rather than forcing a separate allocation for non-verifier mode.

In order to reduce the runtime memory cost of building in verifier support for a retail version, a single pointer it stored to FxVerifierLock if verifier is on. If this pointer is != NULL, lock calls are proxied to this lock function, leaving our internal spinlock redundent.

The decision is to minimize the non-verifier memory footprint so we do not have to compile it out for retail builds, but always have it available through a driver debug setting.

Definition at line 48 of file fxlock.hpp.

Constructor & Destructor Documentation

◆ FxLock()

FxLock::FxLock ( VOID  )
inline

Definition at line 57 of file fxlock.hpp.

60 {
61
62
63
64
67 }
MxLock m_lock
Definition: fxlock.hpp:51
FxVerifierLock * m_Verifier
Definition: fxlock.hpp:54
__inline VOID Initialize()
Definition: mxlockkm.h:43
#define NULL
Definition: types.h:112

◆ ~FxLock()

FxLock::~FxLock ( )
inline

Definition at line 74 of file fxlock.hpp.

75 {
76 if (m_Verifier != NULL) {
77 delete m_Verifier;
78 }
79 }

Member Function Documentation

◆ _When_() [1/4]

FxLock::_When_ ( this->  m_Verifier = NULL,
_Acquires_lock_(this->m_lock  
)
inline

Definition at line 81 of file fxlock.hpp.

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 }
VOID Lock(__out PKIRQL PreviousIrql, __in BOOLEAN AtDpc)
#define FALSE
Definition: types.h:117

◆ _When_() [2/4]

FxLock::_When_ ( this->  m_Verifier = NULL,
_Acquires_lock_(this->m_lock  
)
inline

Definition at line 117 of file fxlock.hpp.

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 }
#define TRUE
Definition: types.h:120
UCHAR KIRQL
Definition: env_spec_w32.h:591

◆ _When_() [3/4]

FxLock::_When_ ( this->  m_Verifier = NULL,
_Releases_lock_(this->m_lock  
)
inline

Definition at line 99 of file fxlock.hpp.

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 }
VOID Unlock(__in KIRQL PreviousIrql, __in BOOLEAN AtDpc)

◆ _When_() [4/4]

FxLock::_When_ ( this->  m_Verifier = NULL,
_Releases_lock_(this->m_lock  
)
inline

Definition at line 134 of file fxlock.hpp.

140 {
141 if (m_Verifier != NULL) {
143 }
144 else {
145 m_lock.ReleaseFromDpcLevel();
146 }
147 }
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

◆ Initialize()

VOID FxLock::Initialize ( __in FxObject ParentObject)

Definition at line 29 of file fxlock.cpp.

45{
47
48 pFxDriverGlobals = ParentObject->GetDriverGlobals();
49
51 //
52 // Allocation failure is not fatal, we just won't track anything
53 //
54
57 ParentObject);
58 }
59}
_Must_inspect_result_ static __inline NTSTATUS CreateAndInitialize(__out FxVerifierLock **VerifierLock, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *ParentObject, __in BOOLEAN UseMutex)
PFX_DRIVER_GLOBALS pFxDriverGlobals
BOOLEAN FxVerifierLock
Definition: fxglobals.h:451

Member Data Documentation

◆ m_lock

MxLock FxLock::m_lock
private

Definition at line 51 of file fxlock.hpp.

Referenced by _When_(), and FxLock().

◆ m_Verifier

FxVerifierLock* FxLock::m_Verifier
private

Definition at line 54 of file fxlock.hpp.

Referenced by _When_(), FxLock(), Initialize(), and ~FxLock().


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