fairness  v1.0.0
A collection of advanced syncronization mechanisms.
Loading...
Searching...
No Matches
boost::fairness::spinlock_priority_mutex< N > Class Template Reference

The spinlock_priority_mutex is an advanced synchronization mechanism that enhances the traditional mutex by introducing a priority-based approach. More...

#include <spinlock_priority_mutex_cpl.hpp>

Public Member Functions

void lock (Priority_t const priority=0)
 Try to acquire the unique ownership of the spinlock_priority_mutex, blocking the thread if the spinlock_priority_mutex was already owned or other threads are waiting with higher priority.
 
void lock (Priority_t const priority=0)
 Try to acquire the unique ownership of the spinlock_priority_mutex, blocking the thread if the spinlock_priority_mutex was already owned or other threads are waiting with higher priority.
 
bool try_lock (Priority_t const priority=0)
 Try to acquire the unique ownership of the spinlock_priority_mutex, if successful will return true, false otherwise.
 
void unlock ()
 Release the spinlock_priority_mutex from unique ownership.
 
void unlock ()
 Release the spinlock_priority_mutex from unique ownership.
 

Detailed Description

template<size_t N = 1>
requires (N >= 1 && N <= BOOST_FAIRNESS_MAXIMUM_PRIORITY)
class boost::fairness::spinlock_priority_mutex< N >

The spinlock_priority_mutex is an advanced synchronization mechanism that enhances the traditional mutex by introducing a priority-based approach.

Template Parameters
N: number of 0 indexed priorities the spinlock_priority_mutex manages, up to BOOST_FAIRNESS_MAXIMUM_PRIORITY.

Member Function Documentation

◆ lock() [1/2]

template<size_t N = 1>
void boost::fairness::spinlock_priority_mutex< N >::lock ( Priority_t const  priority = 0)
inline

Try to acquire the unique ownership of the spinlock_priority_mutex, blocking the thread if the spinlock_priority_mutex was already owned or other threads are waiting with higher priority.

Parameters
priorityused to set a priority for this thread to aquire the lock.
void my_function(int prio) {
//...some code.
m.lock(prio);
//...some code.
}
The spinlock_priority_mutex is an advanced synchronization mechanism that enhances the traditional mu...
Definition spinlock_priority_mutex_cpl.hpp:31

◆ lock() [2/2]

template<size_t N = 1>
void boost::fairness::spinlock_priority_mutex< N >::lock ( Priority_t const  priority = 0)
inline

Try to acquire the unique ownership of the spinlock_priority_mutex, blocking the thread if the spinlock_priority_mutex was already owned or other threads are waiting with higher priority.

Parameters
priorityused to set a priority for this thread to aquire the lock.
void my_function(int prio) {
//...some code.
m.lock(prio);
//...some code.
}

◆ try_lock()

template<size_t N = 1>
bool boost::fairness::spinlock_priority_mutex< N >::try_lock ( Priority_t const  priority = 0)
inline

Try to acquire the unique ownership of the spinlock_priority_mutex, if successful will return true, false otherwise.

Parameters
priorityused to set a priority for this thread to aquire the lock.
void my_function(int prio) {
//...some code.
m.try_lock(prio);
//...some code.
}
Returns
bool

◆ unlock() [1/2]

template<size_t N = 1>
void boost::fairness::spinlock_priority_mutex< N >::unlock ( )
inline

Release the spinlock_priority_mutex from unique ownership.

void my_function() {
//...some code.
m.unlock();
//...some code.
}

◆ unlock() [2/2]

template<size_t N = 1>
void boost::fairness::spinlock_priority_mutex< N >::unlock ( )
inline

Release the spinlock_priority_mutex from unique ownership.

void my_function() {
//...some code.
m.unlock();
//...some code.
}

The documentation for this class was generated from the following files: