|
cortex 0.0.1
|
A cooperative mutex that yields instead of blocking. More...
#include <mutex.hpp>
Classes | |
| class | Guard |
| RAII lock guard for Mutex. More... | |
Public Member Functions | |
| Mutex ()=default | |
| ~Mutex () | |
| Mutex (const Mutex &)=delete | |
| Mutex & | operator= (const Mutex &)=delete |
| void | Lock () |
| Lock the mutex. | |
| bool | TryLock () |
| Try to lock the mutex without yielding. | |
| void | Unlock () |
| Unlock the mutex. | |
| bool | IsLocked () const noexcept |
| Check if the mutex is currently locked. | |
Friends | |
| class | ConditionVariable |
A cooperative mutex that yields instead of blocking.
When a fiber tries to lock an already-locked mutex, it yields control to other fibers until the mutex becomes available.
|
default |
| cortex::tiny_fiber::Mutex::~Mutex | ( | ) |
|
inlinenoexcept |
Check if the mutex is currently locked.
| void cortex::tiny_fiber::Mutex::Lock | ( | ) |
Lock the mutex.
If the mutex is already locked, the current fiber yields until it becomes available.
| bool cortex::tiny_fiber::Mutex::TryLock | ( | ) |
Try to lock the mutex without yielding.
| void cortex::tiny_fiber::Mutex::Unlock | ( | ) |
Unlock the mutex.
If there are fibers waiting for this mutex, one will be scheduled.
|
friend |