Ocean
Ocean::Lock Class Reference

This class implements a recursive lock object. More...

Inheritance diagram for Ocean::Lock:

Public Member Functions

 Lock ()
 Creates a new lock object. More...
 
 ~Lock ()
 Destructs a lock object. More...
 
void lock ()
 Locks the critical section. More...
 
void unlock ()
 Unlocks the critical section. More...
 
bool isLocked ()
 Returns whether this critical section is locked by another thread. More...
 

Protected Member Functions

 Lock (const Lock &lock)=delete
 Disabled copy constructor. More...
 
Lockoperator= (const Lock &lock)=delete
 Disabled assign operator. More...
 

Protected Attributes

CRITICAL_SECTION criticalSection_
 Critical section object of windows. More...
 
pthread_mutex_t mutex_
 Pthread mutex object. More...
 

Detailed Description

This class implements a recursive lock object.

You can either explicitly lock and unlock an Lock object by using the appropriated functions.
However, it's recommended to use the corresponding scope classes for this lock object.

See also
TemplatedLock, ScopedLock, TemplatedScopedLock, TemporaryScopedLock, OptionalScopedLock.

Constructor & Destructor Documentation

◆ Lock() [1/2]

Ocean::Lock::Lock ( )
inline

Creates a new lock object.

◆ ~Lock()

Ocean::Lock::~Lock ( )
inline

Destructs a lock object.

◆ Lock() [2/2]

Ocean::Lock::Lock ( const Lock lock)
protecteddelete

Disabled copy constructor.

Parameters
lockThe lock object to be copied

Member Function Documentation

◆ isLocked()

bool Ocean::Lock::isLocked ( )
inline

Returns whether this critical section is locked by another thread.

Returns
True, if so

◆ lock()

void Ocean::Lock::lock ( )
inline

Locks the critical section.

◆ operator=()

Lock& Ocean::Lock::operator= ( const Lock lock)
protecteddelete

Disabled assign operator.

Parameters
lockThe lock object to be assigned
Returns
Reference to this object

◆ unlock()

void Ocean::Lock::unlock ( )
inline

Unlocks the critical section.

Field Documentation

◆ criticalSection_

CRITICAL_SECTION Ocean::Lock::criticalSection_
protected

Critical section object of windows.

◆ mutex_

pthread_mutex_t Ocean::Lock::mutex_
protected

Pthread mutex object.


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