Ocean
Ocean::ScopedLock Class Reference

This class implements a scoped lock object for recursive lock objects. More...

Public Member Functions

 ScopedLock (Lock &lock)
 Creates a new scoped lock object by a given lock object. More...
 
 ~ScopedLock ()
 Destructs a scoped lock and unlocks the internal lock object. More...
 

Protected Member Functions

 ScopedLock (const ScopedLock &object)=delete
 Disabled accessible copy operator. More...
 
ScopedLockoperator= (const ScopedLock &object)=delete
 Disabled accessible assigns operator. More...
 

Protected Attributes

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

Detailed Description

This class implements a scoped lock object for recursive lock objects.

The application of a scoped lock object ensures that a lock will be unlocked in any case if the scope (in which the object exists) ends.
Thus, possible dead locks can be avoided (e.g., if a function returns while the before the unlock() function of the Lock object is invoke or if an exception is thrown but not intercepted).

See also
Lock, TemplatedScopedLock, TemporaryScopedLock, OptionalScopedLock.

Constructor & Destructor Documentation

◆ ScopedLock() [1/2]

Ocean::ScopedLock::ScopedLock ( Lock lock)
inlineexplicit

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

Parameters
lockThe lock object used for locking

◆ ~ScopedLock()

Ocean::ScopedLock::~ScopedLock ( )
inline

Destructs a scoped lock and unlocks the internal lock object.

◆ ScopedLock() [2/2]

Ocean::ScopedLock::ScopedLock ( const ScopedLock object)
protecteddelete

Disabled accessible copy operator.

Parameters
objectThe object to copy

Member Function Documentation

◆ operator=()

ScopedLock& Ocean::ScopedLock::operator= ( const ScopedLock object)
protecteddelete

Disabled accessible assigns operator.

Parameters
objectThe right object
Returns
Reference to this object

Field Documentation

◆ lock_

Lock& Ocean::ScopedLock::lock_
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: