libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
Mutex Class Reference

Mutual exclusion lock wrapping std::mutex. More...

#include <mutex.h>

Classes

class  Locker
 RAII scoped locker for Mutex. More...
 

Public Member Functions

 Mutex ()=default
 Constructs an unlocked mutex.
 
 ~Mutex ()=default
 Destructor.
 
 Mutex (const Mutex &)=delete
 
Mutexoperator= (const Mutex &)=delete
 
 Mutex (Mutex &&)=delete
 
Mutexoperator= (Mutex &&)=delete
 
void lock ()
 Locks the mutex. Blocks if already locked by another thread.
 
void unlock ()
 Unlocks the mutex.
 
bool tryLock ()
 Attempts to lock the mutex without blocking.
 

Friends

class WaitCondition
 

Detailed Description

Mutual exclusion lock wrapping std::mutex.

Provides a simple mutex with lock/unlock/tryLock and a nested RAII

Example
{
// ... critical section ...
}
Dynamic array container wrapping std::vector.
Definition list.h:40
RAII scoped locker for Mutex.
Definition mutex.h:41
Mutual exclusion lock wrapping std::mutex.
Definition mutex.h:33
void lock()
Locks the mutex. Blocks if already locked by another thread.
Definition mutex.h:77
Locker type for scoped locking. Non-copyable and non-movable.

Member Function Documentation

◆ tryLock()

bool Mutex::tryLock ( )
inline

Attempts to lock the mutex without blocking.

Returns
True if the lock was acquired, false otherwise.

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