|
HikoGUI
A low latency retained GUI
|
#include <hikogui/unfair_rwmutex.hpp>
Public Member Functions | |
| bool | is_locked () const noexcept |
| hi_force_inline bool | exclusive_try_lock () noexcept |
| When try_lock() is called from a thread that already owns the lock it will return false. | |
| hi_force_inline void | exclusive_lock () noexcept |
| hi_force_inline void | exclusive_unlock () noexcept |
| Unlock the mutex. | |
| hi_force_inline void | shared_lock () noexcept |
| Get a shared lock. | |
| hi_force_inline bool | shared_try_lock () noexcept |
| hi_force_inline void | shared_unlock () noexcept |
An unfair mutex This is a fast implementation of a mutex which does not fairly arbitrate between multiple blocking threads.
Due to the unfairness it is possible that blocking threads will be completely starved.
This mutex however does block on a operating system's futex/unfair_mutex primitives and therefor thread priority are properly handled.
On windows and Linux the compiler generally emits the following sequence of instructions:
|
inlinenoexcept |
When try_lock() is called from a thread that already owns the lock it will return false.
Calling try_lock() in a loop will bypass the operating system's wait system, meaning that no priority inversion will take place.
|
inlinenoexcept |
Unlock the mutex.
|
inlinenoexcept |
Get a shared lock.