14#ifndef BOOST_FAIRNESS_COHERENT_PRIORITY_LOCK_HPP
15#define BOOST_FAIRNESS_COHERENT_PRIORITY_LOCK_HPP
32 template<WaitMechanism W = WaitMechanism::Spin>
43 tail_.store(firstTail);
45 head_.store(firstTail);
50 requester->
watch_ = tail_.exchange(requester->
request_, std::memory_order_acquire);
66 Request* localHighestPriorityReq;
75 localHighestPriorityReq = head_.load();
76 currentThread = head_.load()->watcher_;
78 while (currentThread !=
nullptr){
79 if (currentThread->
priority_ < localHighestPriority){
80 localHighestPriority = currentThread->
priority_;
81 localHighestPriorityReq = currentThread->
watch_;
86 localHighestPriorityReq->
state_.store(
GRANTED, std::memory_order_release);
97 std::atomic<Request*> tail_{
nullptr};
98 std::atomic<Request*> head_{
nullptr};
Definition coherent_priority_lock.hpp:33
void requestLock(Thread *const requester)
Definition coherent_priority_lock.hpp:49
void grantLock(Thread *const requester)
Definition coherent_priority_lock.hpp:63
void initialize(Request *const firstTail)
Definition coherent_priority_lock.hpp:39
coherent_priority_lock()=default
This file contains configurations about boost and 128bit cpu support. TODO.
Definition coherent_priority_lock.hpp:25
void wait(T &mem, K const expected) noexcept
Definition wait_ops.hpp:69
WaitMechanism
Definition coherent_priority_lock.hpp:27
void spin_wait() noexcept
Definition wait_ops.hpp:56
void notify_one(T &mem) noexcept
Definition wait_ops.hpp:103
uint8_t Priority_t
Definition priority_t.hpp:17
Alias the type Priority_t. Priority_t is the type of priorities that are used by the priority_mutexes...
#define BOOST_FAIRNESS_MAXIMUM_PRIORITY
Priorities are indexes in an array, that means that if I define a priority_mutex<BOOST_FAIRNESS_MAXIM...
Definition priority_t.hpp:24
This file contains the implementation of a static very fast and simple request pool.
#define PENDING
Definition request_pool.hpp:20
#define GRANTED
Definition request_pool.hpp:21
Definition request_pool.hpp:25
std::atomic< uint32_t > state_
Definition request_pool.hpp:28
Thread * watcher_
Definition request_pool.hpp:26
Thread * thread_
Definition request_pool.hpp:27
Definition thread_pool.hpp:24
Request * request_
Definition thread_pool.hpp:40
Request * watch_
Definition thread_pool.hpp:39
Priority_t priority_
Definition thread_pool.hpp:42
This file contains the implementation of a pool of thread structs.
This file contains the implementation of the wait operations used by the mutexes.