16#if defined(__FRC_ROBORIO__) && !defined(WPI_USE_PRIORITY_MUTEX)
17#define WPI_USE_PRIORITY_MUTEX
20#if defined(WPI_USE_PRIORITY_MUTEX) && defined(__linux__)
22#define WPI_HAVE_PRIORITY_MUTEX 1
24class priority_recursive_mutex {
26 using native_handle_type = pthread_mutex_t*;
28 constexpr priority_recursive_mutex() noexcept = default;
29 priority_recursive_mutex(const priority_recursive_mutex&) = delete;
30 priority_recursive_mutex& operator=(const priority_recursive_mutex&) = delete;
33 void lock() { pthread_mutex_lock(&m_mutex); }
36 void unlock() { pthread_mutex_unlock(&m_mutex); }
39 bool try_lock() noexcept {
return !pthread_mutex_trylock(&m_mutex); }
41 pthread_mutex_t* native_handle() {
return &m_mutex; }
46#ifdef __PTHREAD_MUTEX_HAVE_PREV
47 pthread_mutex_t m_mutex = {
48 {0, 0, 0, 0, 0x20 | PTHREAD_MUTEX_RECURSIVE_NP, __PTHREAD_SPINS, {0, 0}}};
50 pthread_mutex_t m_mutex = {
51 {0, 0, 0, 0x20 | PTHREAD_MUTEX_RECURSIVE_NP, 0, {__PTHREAD_SPINS}}};
57 using native_handle_type = pthread_mutex_t*;
59 constexpr priority_mutex() noexcept = default;
60 priority_mutex(const priority_mutex&) = delete;
61 priority_mutex& operator=(const priority_mutex&) = delete;
64 void lock() { pthread_mutex_lock(&m_mutex); }
67 void unlock() { pthread_mutex_unlock(&m_mutex); }
70 bool try_lock() noexcept {
return !pthread_mutex_trylock(&m_mutex); }
72 pthread_mutex_t* native_handle() {
return &m_mutex; }
76#ifdef __PTHREAD_MUTEX_HAVE_PREV
77 pthread_mutex_t m_mutex = {{0, 0, 0, 0, 0x20, __PTHREAD_SPINS, {0, 0}}};
79 pthread_mutex_t m_mutex = {{0, 0, 0, 0x20, 0, {__PTHREAD_SPINS}}};
Definition: ntcore_cpp.h:26