7#include "unfair_mutex.hpp"
67 if (owner.
load(std::memory_order::acquire) == current_thread_id()) {
79 ttlet thread_id = current_thread_id();
84 if (owner.
load(std::memory_order::acquire) == thread_id) {
97 owner.
store(thread_id, std::memory_order::release);
125 ttlet thread_id = current_thread_id();
130 if (owner.
load(std::memory_order::acquire) == thread_id) {
132 tt_axiom(count != 0);
142 tt_axiom(count == 0);
144 tt_axiom(owner == 0);
145 owner.
store(thread_id, std::memory_order::release);
149 void unlock() noexcept {
151 tt_axiom(
recurse_lock_count(),
"Unlock must be called on the thread that locked the mutex");
159 owner.
store(0, std::memory_order::release);
An unfair mutex This is a fast implementation of a mutex which does not fairly arbitrate between mult...
Definition unfair_mutex.hpp:33
bool try_lock() noexcept
When try_lock() is called from a thread that already owns the lock it will return false.
Definition unfair_mutex.hpp:79
An unfair recursive-mutex This is a fast implementation of a recursive-mutex which does not fairly ar...
Definition unfair_recursive_mutex.hpp:32
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:77
void lock() noexcept
Definition unfair_recursive_mutex.hpp:123
int recurse_lock_count() const noexcept
This function should be used in tt_axiom() to check if the lock is held by current thread.
Definition unfair_recursive_mutex.hpp:60