13#include "../macros.hpp"
16namespace hi {
inline namespace v1 {
96 if (owner.load(std::memory_order::acquire) == thread_id) {
104 }
else if (mutex.try_lock()) {
106 hi_axiom(count == 0);
108 hi_axiom(owner == 0);
113 owner.store(thread_id, std::memory_order::release);
151 if (owner.load(std::memory_order::acquire) == thread_id) {
153 hi_axiom(count != 0);
163 hi_axiom(count == 0);
165 hi_axiom(owner == 0);
170 owner.store(thread_id, std::memory_order::release);
174 void unlock() noexcept
187 owner.
store(0, std::memory_order::release);
Functions and types for accessing operating system threads.
Definition of the unfair_mutex.
thread_id current_thread_id() noexcept
Get the current thread id.
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
The HikoGUI API version 1.
Definition lookahead_iterator.hpp:6
An unfair mutex This is a fast implementation of a mutex which does not fairly arbitrate between mult...
Definition unfair_mutex_intf.hpp:38
An unfair recursive-mutex This is a fast implementation of a recursive-mutex which does not fairly ar...
Definition unfair_recursive_mutex.hpp:38
void lock() noexcept
Definition unfair_recursive_mutex.hpp:139
bool try_lock() noexcept
When try_lock() is called on a thread that already holds the lock true is returned.
Definition unfair_recursive_mutex.hpp:84
int recurse_lock_count() const noexcept
This function should be used in hi_axiom() to check if the lock is held by current thread.
Definition unfair_recursive_mutex.hpp:66