Mutual exclusion (or mutex for short) is used to avoid simultaneous use of a shared resource. More...
#include <Radiant/Mutex.hpp>
Public Member Functions | |
| void | lock () |
| Lock the mutex If another thread has already locked the mutex the calling thread will block until the other thread unlocks the mutex. More... | |
| Mutex (bool recursive=false) | |
| Construct a mutex. More... | |
| bool | tryLock () |
| Try to lock the mutex Tries to lock the mutex but does not block if the mutex has already been locked. More... | |
| void | unlock () |
| Unlock the mutex Must be called from the same thread as the mutex was locked from. More... | |
| ~Mutex () | |
| Destructor. | |
Friends | |
| class | Condition |
Mutual exclusion (or mutex for short) is used to avoid simultaneous use of a shared resource.
A mutex can be recursive. This means the same calling thread can lock the mutex more than once and won't deadlock.
| Radiant::Mutex::Mutex | ( | bool | recursive = false | ) |
Construct a mutex.
| recursive | if true, create a recursive mutex |
| void Radiant::Mutex::lock | ( | ) |
Lock the mutex If another thread has already locked the mutex the calling thread will block until the other thread unlocks the mutex.
| bool Radiant::Mutex::tryLock | ( | ) |
Try to lock the mutex Tries to lock the mutex but does not block if the mutex has already been locked.
| void Radiant::Mutex::unlock | ( | ) |
Unlock the mutex Must be called from the same thread as the mutex was locked from.