mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
Implement bool operator for ObjectLock
This commit is contained in:
parent
4c0628c24d
commit
8ef921aa5e
@ -65,3 +65,15 @@ void ObjectLock::Unlock()
|
||||
m_Locked = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the object is locked, false otherwise.
|
||||
*
|
||||
* This operator allows using ObjectLock in boolean contexts.
|
||||
*
|
||||
* @returns true if the object is locked, false otherwise.
|
||||
*/
|
||||
ObjectLock::operator bool() const
|
||||
{
|
||||
return m_Locked;
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
void Lock();
|
||||
void Unlock();
|
||||
|
||||
operator bool() const;
|
||||
|
||||
private:
|
||||
const Object *m_Object{nullptr};
|
||||
bool m_Locked{false};
|
||||
|
Loading…
x
Reference in New Issue
Block a user