fairness  v1.0.0
A collection of advanced syncronization mechanisms.
Loading...
Searching...
No Matches
priority_mutex_cpl.hpp
Go to the documentation of this file.
1
13#ifndef BOOST_FAIRNESS_PRIORITY_MUTEX_CPL_HPP
14#define BOOST_FAIRNESS_PRIORITY_MUTEX_CPL_HPP
15#include <atomic>
16#include <array>
22
23namespace boost::fairness{
24
45 template<size_t N = 1>
46 requires (N >= 1 && N <= BOOST_FAIRNESS_MAXIMUM_PRIORITY)
48
49 using Thread_cnt_t = uint32_t;
50
51 public:
52
54 priority_mutex() = default;
55
57 priority_mutex(const priority_mutex&) = delete;
58
60 priority_mutex& operator=(const priority_mutex&) = delete;
61
64
66 priority_mutex& operator=(priority_mutex&&) = delete;
67
69 ~priority_mutex() = default;
70
110 void lock(Priority_t const priority = 0){
111
112 lll_.lock(priority);
113 }
114
152 void unlock(){
153
154 lll_.unlock();
155
156 }
157
206 /* The try_lock for the Craig algorithm will be implemented in a future update.
207
208 [[nodiscard]] bool try_lock(Priority_t const priority = 0){ // try lock is difficult with the cpr logic
209
210 lll_.try_lock(priority);
211 }
212 */
213
214 private:
215
217
218 };
219
220}
221#endif // BOOST_FAIRNESS_PRIORITY_MUTEX_CPL_HPP
Definition pqlock.hpp:25
The priority_mutex is an advanced synchronization mechanism that enhances the traditional mutex by in...
Definition priority_mutex_cpl.hpp:47
void lock(Priority_t const priority=0)
Acquire the priority_mutex with a designated priority. If another thread has already obtained the loc...
Definition priority_mutex_cpl.hpp:110
void unlock()
Unlocks the priority-mutex. It is essential for the priority-mutex to be held by the current thread ...
Definition priority_mutex_cpl.hpp:152
#define BOOST_FAIRNESS_HARDWARE_DESTRUCTIVE_SIZE
Size to be aligned to avoid false sharing
Definition config.hpp:85
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
This file contains the implementation of the spinlock_priority_mutex based on a scalable list base al...
This file contains the implementation of the wait operations used by the mutexes.
This file contains the implementation of a wait pool.