OpendTect  7.0
Public Member Functions | Protected Attributes | List of all members
Threads::Mutex Class Reference

Is a lock that allows a thread to have exlusive rights to something. More...

Inheritance diagram for Threads::Mutex:
[legend]

Public Member Functions

 Mutex (bool recursive=false)
 
 Mutex (const Mutex &)=delete
 
virtual ~Mutex ()
 
int getCount () const
 
bool isRecursive () const
 
void lock ()
 
bool tryLock ()
 
void unLock ()
 

Protected Attributes

int count_ = 0
 Only set in debug-mode. More...
 
ThreadID lockingthread_ = 0
 Only set in debug-mode. More...
 
QMutex * qmutex_ = nullptr
 
QRecursiveMutex * qrecursivemutex_ = nullptr
 

Detailed Description

Is a lock that allows a thread to have exlusive rights to something.

It is guaranteed that once locked, no one else will be able to lock it before it is unlocked. If a thread tries to lock it, it will be postponed until the thread that has locked it will unlock it.

<>

Constructor & Destructor Documentation

◆ Mutex() [1/2]

Threads::Mutex::Mutex ( bool  recursive = false)

◆ Mutex() [2/2]

Threads::Mutex::Mutex ( const Mutex )
delete

◆ ~Mutex()

virtual Threads::Mutex::~Mutex ( )
virtual

Member Function Documentation

◆ getCount()

int Threads::Mutex::getCount ( ) const
inline

◆ isRecursive()

bool Threads::Mutex::isRecursive ( ) const
inline

◆ lock()

void Threads::Mutex::lock ( )

◆ tryLock()

bool Threads::Mutex::tryLock ( )

Returns true if mutex is locked. If it is locked, it you must unLock it when you are finished. If it returns false, carry on with your life.

◆ unLock()

void Threads::Mutex::unLock ( )

Member Data Documentation

◆ count_

int Threads::Mutex::count_ = 0
protected

Only set in debug-mode.

◆ lockingthread_

ThreadID Threads::Mutex::lockingthread_ = 0
protected

Only set in debug-mode.

◆ qmutex_

QMutex* Threads::Mutex::qmutex_ = nullptr
protected

◆ qrecursivemutex_

QRecursiveMutex* Threads::Mutex::qrecursivemutex_ = nullptr
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024