Add pointer constructor to CriticalSectionScoped.
Mainly added to simplyfy the code, e.g. when having critsect as scoped_ptr in classes. Review URL: http://webrtc-codereview.appspot.com/302005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1144 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
af225d6bf6
commit
b19582b7dc
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user