7#include "../utility/module.hpp"
11namespace hi::inline
v1 {
50 [[nodiscard]] hi_force_inline
bool is_locked() const noexcept
52 return to_bool(_lock_count.load(std::memory_order::relaxed));
59 hi_force_inline
void lock() noexcept
61 hilet lock_count = _lock_count.fetch_add(1, std::memory_order::acquire);
69 hi_force_inline
void unlock() noexcept
71 auto lock_count = _lock_count.fetch_sub(1, std::memory_order::release);
73 if (lock_count == 1) {
75 _version.fetch_add(1, std::memory_order::relaxed);
85 return _version.load(std::memory_order::acquire);
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:238
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:13
Counts how many times a critical section was idle.
Definition wfree_idle_count.hpp:37
hi_force_inline void lock() noexcept
Start the critical section.
Definition wfree_idle_count.hpp:59
hi_force_inline bool is_locked() const noexcept
Check if the critical section is locked.
Definition wfree_idle_count.hpp:50
hi_force_inline uint64_t operator*() const noexcept
Get the current idle-count.
Definition wfree_idle_count.hpp:83
hi_force_inline void unlock() noexcept
End the critical section.
Definition wfree_idle_count.hpp:69