13#include "../utility/utility.hpp"
14#include "../macros.hpp"
18hi_export_module(hikogui.concurrency.unfair_recursive_mutex);
20hi_export
namespace hi {
inline namespace v1 {
100 if (owner.
load(std::memory_order::acquire) == thread_id) {
102 hi_axiom(count != 0);
110 hi_axiom(count == 0);
112 hi_axiom(owner == 0);
117 owner.
store(thread_id, std::memory_order::release);
155 if (owner.
load(std::memory_order::acquire) == thread_id) {
157 hi_axiom(count != 0);
167 hi_axiom(count == 0);
169 hi_axiom(owner == 0);
174 owner.
store(thread_id, std::memory_order::release);
178 void unlock() noexcept
191 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.
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
An unfair mutex This is a fast implementation of a mutex which does not fairly arbitrate between mult...
Definition unfair_mutex_intf.hpp:38
bool try_lock() noexcept
When try_lock() is called from a thread that already owns the lock it will return false.
Definition unfair_mutex_impl.hpp:216
An unfair recursive-mutex This is a fast implementation of a recursive-mutex which does not fairly ar...
Definition unfair_recursive_mutex.hpp:42
void lock() noexcept
Definition unfair_recursive_mutex.hpp:143
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:88
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:70