Added SetTo() methods to the AutoLocker.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4221 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
cc6edbdf8f
commit
f31cbc2db6
@ -155,18 +155,30 @@ public:
|
||||
_Unlock();
|
||||
}
|
||||
|
||||
inline AutoLocker<Lockable, Locking> &operator=(Lockable *lockable)
|
||||
inline void SetTo(Lockable *lockable, bool alreadyLocked)
|
||||
{
|
||||
_Unlock();
|
||||
fLockable = lockable;
|
||||
_Lock();
|
||||
fLocked = alreadyLocked;
|
||||
if (!fLocked)
|
||||
_Lock();
|
||||
}
|
||||
|
||||
inline void SetTo(Lockable &lockable, bool alreadyLocked)
|
||||
{
|
||||
SetTo(&lockable, alreadyLocked);
|
||||
}
|
||||
|
||||
inline AutoLocker<Lockable, Locking> &operator=(Lockable *lockable)
|
||||
{
|
||||
SetTo(lockable);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline AutoLocker<Lockable, Locking> &operator=(Lockable &lockable)
|
||||
{
|
||||
_Unlock();
|
||||
fLockable = &lockable;
|
||||
_Lock();
|
||||
SetTo(&lockable);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool IsLocked() const { return fLocked; }
|
||||
|
Loading…
Reference in New Issue
Block a user