13#ifndef BOOST_FAIRNESS_CONTROL_BLOCK_T_HPP
14#define BOOST_FAIRNESS_CONTROL_BLOCK_T_HPP
25 #define LOCK_NOT_OWNED 0
54 static_assert(std::atomic<control_block_64b_simple_t>::is_always_lock_free,
"control_block_64b_simple_t is not lock free");
61 struct control_block_64b_t{
77 control_block_64b_t setOwned()
const {
78 control_block_64b_t new_ctrl = *
this;
79 new_ctrl.owned_ |= 0b10000000;
88 control_block_64b_t increasePriority(
Priority_t const priority)
const {
89 control_block_64b_t new_ctrl = *
this;
90 ++new_ctrl.priority_[priority];
99 control_block_64b_t decreasePriority(
Priority_t const priority)
const {
100 control_block_64b_t new_ctrl = *
this;
101 --new_ctrl.priority_[priority];
110 control_block_64b_t setPriority(
Priority_t const priority)
const {
111 control_block_64b_t new_ctrl = *
this;
112 new_ctrl.owned_ = priority;
121 return owned_ & 0b01111111;
129 bool isOwned_()
const{
134 #define BOOST_FAIRNESS_SPM64B_SUPPORTED_PRIORITIES sizeof(control_block_64b_t::priority_)
136 static_assert(std::atomic<control_block_64b_t>::is_always_lock_free,
"control_block64b_t is not lock free");
138 #ifdef BOOST_FAIRNESS_HAS_DWCAS
140 struct control_block_128b_t{
150 uint8_t priority_[15];
155 control_block_128b_t setOwned()
const {
156 control_block_128b_t new_ctrl = *
this;
157 new_ctrl.owned_ |= 0b10000000;
164 control_block_128b_t increasePriority(Priority_t
const priority)
const {
165 control_block_128b_t new_ctrl = *
this;
166 ++new_ctrl.priority_[priority];
173 control_block_128b_t decreasePriority(Priority_t
const priority)
const {
174 control_block_128b_t new_ctrl = *
this;
175 --new_ctrl.priority_[priority];
182 control_block_128b_t setPriority(Priority_t
const priority)
const {
183 control_block_128b_t new_ctrl = *
this;
184 new_ctrl.owned_ = priority;
191 Priority_t getPriority()
const {
192 return owned_ & 0b01111111;
198 bool isOwned_()
const{
202 #define BOOST_FAIRNESS_SPM128B_SUPPORTED_PRIORITIES sizeof(control_block_128b_t::priority_)
204 static_assert(boost::atomic<control_block_128b_t>::is_always_lock_free,
"control_block128b_t is not lock free");
This file contains configurations about boost and 128bit cpu support. TODO.
#define LOCK_NOT_OWNED
Definition control_block_t.hpp:25
#define LOCK_OWNED
Definition control_block_t.hpp:24
Definition acquisition_modes.hpp:16
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
Definition control_block_t.hpp:22
control_block_64b_simple_t setPriority(Priority_t const priority) const
Definition control_block_t.hpp:36
uint32_t owned_
Definition control_block_t.hpp:27
Priority_t getPriority() const
Definition control_block_t.hpp:42
bool isOwned() const
Definition control_block_t.hpp:46
control_block_64b_simple_t setOwned() const
Definition control_block_t.hpp:30
uint32_t priority_
Definition control_block_t.hpp:28