OpenThreads
OpenThreads::Mutex Class Reference

This class provides an object-oriented thread mutex interface. More...

#include <Mutex>

Inheritance diagram for OpenThreads::Mutex:

Public Types

enum  MutexType { MUTEX_NORMAL , MUTEX_RECURSIVE }

Public Member Functions

 Mutex (MutexType type=MUTEX_NORMAL)
 Constructor.
virtual ~Mutex ()
 Destructor.
MutexType getMutexType () const
virtual int lock ()
 Lock the mutex.
virtual int unlock ()
 Unlock the mutex.
virtual int trylock ()
 Test if mutex can be locked.

Friends

class Condition

Detailed Description

This class provides an object-oriented thread mutex interface.

Member Enumeration Documentation

◆ MutexType

Enumerator
MUTEX_NORMAL 
MUTEX_RECURSIVE 

Constructor & Destructor Documentation

◆ Mutex()

OpenThreads::Mutex::Mutex ( MutexType type = MUTEX_NORMAL)

Constructor.

References MUTEX_NORMAL.

Referenced by OpenThreads::ReentrantMutex::ReentrantMutex(), and trylock().

◆ ~Mutex()

virtual OpenThreads::Mutex::~Mutex ( )
virtual

Destructor.

Member Function Documentation

◆ getMutexType()

MutexType OpenThreads::Mutex::getMutexType ( ) const
inline

◆ lock()

virtual int OpenThreads::Mutex::lock ( )
virtual

Lock the mutex.

Returns
0 if normal, -1 if errno set, errno code otherwise.

◆ trylock()

virtual int OpenThreads::Mutex::trylock ( )
virtual

Test if mutex can be locked.

Returns
0 if normal, -1 if errno set, errno code otherwise.

References Mutex().

◆ unlock()

virtual int OpenThreads::Mutex::unlock ( )
virtual

Unlock the mutex.

Returns
0 if normal, -1 if errno set, errno code otherwise.

◆ Condition

friend class Condition
friend

References Condition.

Referenced by Condition.


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

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenThreads by doxygen 1.14.0.