fairness  v1.0.0
A collection of advanced syncronization mechanisms.
Loading...
Searching...
No Matches
spinlock_priority_mutex_cpl.hpp
Go to the documentation of this file.
1
13#ifndef BOOST_FAIRNESS_SPINLOCK_PRIORITY_MUTEX_CPL_HPP
14#define BOOST_FAIRNESS_SPINLOCK_PRIORITY_MUTEX_CPL_HPP
15#include <atomic>
16#include <array>
20
21
22namespace boost::fairness{
23
29 template<size_t N = 1>
30 requires (N >= 1 && N <= BOOST_FAIRNESS_MAXIMUM_PRIORITY)
32
33 using Thread_cnt_t = uint32_t;
34
35 public:
36
38 spinlock_priority_mutex() = default;
39
42
44 spinlock_priority_mutex& operator=(const spinlock_priority_mutex&) = delete;
45
48
51
53 ~spinlock_priority_mutex() = default;
54
70 void lock(Priority_t const priority = 0){
71 lll_.lock(priority);
72 }
73
87 void unlock(){
88 lll_.unlock();
89 }
90
107 //[[nodiscard]] bool try_lock(Priority_t const priority = 0){ // TODO
108 // return false;
109 //}
110
111 private:
112
114
115 };
116}
117#endif // BOOST_FAIRNESS_SPINLOCK_PRIORITY_MUTEX_CPL_HPP
Definition pqspinlock.hpp:25
The spinlock_priority_mutex is an advanced synchronization mechanism that enhances the traditional mu...
Definition spinlock_priority_mutex_cpl.hpp:31
void lock(Priority_t const priority=0)
Try to acquire the unique ownership of the spinlock_priority_mutex, blocking the thread if the spinlo...
Definition spinlock_priority_mutex_cpl.hpp:70
void unlock()
Release the spinlock_priority_mutex from unique ownership.
Definition spinlock_priority_mutex_cpl.hpp:87
Definition acquisition_modes.hpp:16
uint8_t Priority_t
Definition priority_t.hpp:17
This file contains the implementation of a priority qlock.
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 wait operations used by the mutexes.