diff options
Diffstat (limited to 'src/system_wrappers/interface/critical_section_wrapper.h')
-rw-r--r-- | src/system_wrappers/interface/critical_section_wrapper.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/system_wrappers/interface/critical_section_wrapper.h b/src/system_wrappers/interface/critical_section_wrapper.h index ad31497e76..cfec9ae79d 100644 --- a/src/system_wrappers/interface/critical_section_wrapper.h +++ b/src/system_wrappers/interface/critical_section_wrapper.h @@ -33,18 +33,26 @@ public: virtual void Leave() = 0; }; -// RAII extension of the critical section. Prevents Enter/Leave missmatches and +// RAII extension of the critical section. Prevents Enter/Leave mismatches and // provides more compact critical section syntax. class CriticalSectionScoped { public: - CriticalSectionScoped(CriticalSectionWrapper& critsec) - : - _ptrCritSec(&critsec) + // Deprecated, don't add more users of this constructor. + // TODO(mflodman) Remove this version of the constructor when no one is + // using it any longer. + explicit CriticalSectionScoped(CriticalSectionWrapper& critsec) + : _ptrCritSec(&critsec) { _ptrCritSec->Enter(); } + explicit CriticalSectionScoped(CriticalSectionWrapper* critsec) + : _ptrCritSec(critsec) + { + _ptrCritSec->Enter(); + } + ~CriticalSectionScoped() { if (_ptrCritSec) |