14#ifndef BOOST_FAIRNESS_WAIT_OPS_HPP
15#define BOOST_FAIRNESS_WAIT_OPS_HPP
25 static const std::function<void()> relaxOrYield[] = {
pause ,std::this_thread::yield};
28 template<
typename T ,
typename K>
29 inline void spin_wait(T& mem, K
const expected)
noexcept {
33 if (mem.load(std::memory_order_relaxed) != expected)
43 inline void spin_wait(std::atomic_flag& mem, K
const expected)
noexcept {
47 if (mem.test(std::memory_order_relaxed) != expected)
66#if !defined(BOOST_FAIRNESS_USE_STD_WAIT_NOTIFY)
68 template<
typename T,
typename K>
69 inline void wait(T& mem, K
const expected)
noexcept {
71 auto memEqualsExpected = [&mem, expected]{
72 return mem.load(std::memory_order_relaxed) == expected;
80 if (!memEqualsExpected())
89 }
while (memEqualsExpected());
95 template<
typename T,
typename K>
96 inline void wait(T& mem, K expected)
noexcept {
This file contains configurations about boost and 128bit cpu support. TODO.
#define BOOST_FAIRNESS_WAIT_SPINS_RELAXED
The total number of spins during a wait operation before a syscall to the OS to yield the cpu through...
Definition config.hpp:76
#define BOOST_FAIRNESS_GETREQUEST_SPINS_RELAXED
The number of paused spins performed while performing a getRequest (this is used only if BOOST_FAIRNE...
Definition config.hpp:40
#define BOOST_FAIRNESS_GETREQUEST_SPINS
The total number of spins performed while performing a getRequest (this is used only if BOOST_FAIRNES...
Definition config.hpp:31
#define BOOST_FAIRNESS_SPINWAIT_SPINS_RELAXED
The number of relaxed spins during a spin_wait operation.
Definition config.hpp:58
#define BOOST_FAIRNESS_SPINWAIT_SPINS
The total number of spins during a spin_wait operation.
Definition config.hpp:49
#define BOOST_FAIRNESS_WAIT_SPINS
The total number of spins during a wait operation before a syscall to the OS to yield the cpu through...
Definition config.hpp:67
Definition coherent_priority_lock.hpp:25
void wait(T &mem, K const expected) noexcept
Definition wait_ops.hpp:69
void wait_(T &mem, K expected)
Definition wait_ops_generic.hpp:22
void notify_one_(T &mem)
Definition wait_ops_generic.hpp:31
void notify_all(T &mem) noexcept
Definition wait_ops.hpp:108
void notify_all_(T &mem)
Definition wait_ops_generic.hpp:40
void spin_wait() noexcept
Definition wait_ops.hpp:56
void pause() noexcept
Definition pause_ops.hpp:21
void notify_one(T &mem) noexcept
Definition wait_ops.hpp:103
This file contains the implementation of the pause operations used by the mutexes.