16#if defined(__FRC_SYSTEMCORE__) && !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; }
47 pthread_mutex_t m_mutex = {
48 {__PTHREAD_MUTEX_INITIALIZER(0x20 | PTHREAD_MUTEX_RECURSIVE_NP)}};
53 using native_handle_type = pthread_mutex_t*;
55 constexpr priority_mutex() noexcept = default;
56 priority_mutex(const priority_mutex&) = delete;
57 priority_mutex& operator=(const priority_mutex&) = delete;
60 void lock() { pthread_mutex_lock(&m_mutex); }
63 void unlock() { pthread_mutex_unlock(&m_mutex); }
66 bool try_lock() noexcept {
return !pthread_mutex_trylock(&m_mutex); }
68 pthread_mutex_t* native_handle() {
return &m_mutex; }
73 pthread_mutex_t m_mutex = {{__PTHREAD_MUTEX_INITIALIZER(0x20)}};
Definition ntcore_cpp.h:26