Ocean
Ocean::TemporaryScopedLock Class Reference

This class implements a recursive scoped lock object allowing to release the lock before the scoped object itself is released. More...

Public Member Functions

 TemporaryScopedLock ()=default
 Creates a new scoped lock object which is not locked yet. More...
 
 TemporaryScopedLock (Lock &lock)
 Creates a new scoped lock object by a given lock object. More...
 
 ~TemporaryScopedLock ()
 Destructs a scoped lock and unlocks the internal lock object (if still locked). More...
 
Locklock () const
 Returns the lock object which (if existing) is locked during the existence of this scoped lock object. More...
 
void release ()
 Explicitly releases the lock before the scoped lock object is released. More...
 
void relock (Lock &lock)
 Re-locks this scoped lock with a given lock. More...
 
bool isReleased () const
 Returns whether this scoped lock is released already. More...
 

Protected Member Functions

 TemporaryScopedLock (const TemporaryScopedLock &object)=delete
 Disabled accessible copy operator. More...
 
TemporaryScopedLockoperator= (const TemporaryScopedLock &object)=delete
 Disabled accessible assigns operator. More...
 

Protected Attributes

Locklock_ = nullptr
 Lock object which is locked during the existence of this scoped lock object. More...
 

Detailed Description

This class implements a recursive scoped lock object allowing to release the lock before the scoped object itself is released.

See also
Lock, ScopedLock, TemplatedScopedLock, OptionalScopedLock.

Constructor & Destructor Documentation

◆ TemporaryScopedLock() [1/3]

Ocean::TemporaryScopedLock::TemporaryScopedLock ( )
default

Creates a new scoped lock object which is not locked yet.

◆ TemporaryScopedLock() [2/3]

Ocean::TemporaryScopedLock::TemporaryScopedLock ( Lock lock)
inlineexplicit

Creates a new scoped lock object by a given lock object.

Parameters
lockThe lock object used for locking

◆ ~TemporaryScopedLock()

Ocean::TemporaryScopedLock::~TemporaryScopedLock ( )
inline

Destructs a scoped lock and unlocks the internal lock object (if still locked).

◆ TemporaryScopedLock() [3/3]

Ocean::TemporaryScopedLock::TemporaryScopedLock ( const TemporaryScopedLock object)
inlineprotecteddelete

Disabled accessible copy operator.

Parameters
objectThe object to copy

Member Function Documentation

◆ isReleased()

bool Ocean::TemporaryScopedLock::isReleased ( ) const
inline

Returns whether this scoped lock is released already.

Returns
True, if so

◆ lock()

Lock * Ocean::TemporaryScopedLock::lock ( ) const
inline

Returns the lock object which (if existing) is locked during the existence of this scoped lock object.

Returns
The associated lock object, nullptr if this object is already released (or was never locked)

◆ operator=()

TemporaryScopedLock& Ocean::TemporaryScopedLock::operator= ( const TemporaryScopedLock object)
inlineprotecteddelete

Disabled accessible assigns operator.

Parameters
objectThe right object
Returns
Reference to this object

◆ release()

void Ocean::TemporaryScopedLock::release ( )
inline

Explicitly releases the lock before the scoped lock object is released.

◆ relock()

void Ocean::TemporaryScopedLock::relock ( Lock lock)
inline

Re-locks this scoped lock with a given lock.

This scoped lock must be released before re-locking it again.

Parameters
lockThe lock to be used for locking
See also
isReleased().

Field Documentation

◆ lock_

Lock* Ocean::TemporaryScopedLock::lock_ = nullptr
protected

Lock object which is locked during the existence of this scoped lock object.


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