21 #define WPI_HAVE_PRIORITY_MUTEX 1 23 class priority_recursive_mutex {
25 typedef pthread_mutex_t* native_handle_type;
27 constexpr priority_recursive_mutex() noexcept = default;
28 priority_recursive_mutex(const priority_recursive_mutex&) = delete;
29 priority_recursive_mutex& operator=(const priority_recursive_mutex&) = delete;
32 void lock() { pthread_mutex_lock(&m_mutex); }
35 void unlock() { pthread_mutex_unlock(&m_mutex); }
38 bool try_lock() noexcept {
return !pthread_mutex_trylock(&m_mutex); }
40 pthread_mutex_t* native_handle() {
return &m_mutex; }
45 #ifdef __PTHREAD_MUTEX_HAVE_PREV 46 pthread_mutex_t m_mutex = {
47 {0, 0, 0, 0, 0x20 | PTHREAD_MUTEX_RECURSIVE_NP, __PTHREAD_SPINS, {0, 0}}};
49 pthread_mutex_t m_mutex = {
50 {0, 0, 0, 0x20 | PTHREAD_MUTEX_RECURSIVE_NP, 0, {__PTHREAD_SPINS}}};
54 class priority_mutex {
56 typedef pthread_mutex_t* native_handle_type;
58 constexpr priority_mutex() noexcept = default;
59 priority_mutex(const priority_mutex&) = delete;
60 priority_mutex& operator=(const priority_mutex&) = delete;
63 void lock() { pthread_mutex_lock(&m_mutex); }
66 void unlock() { pthread_mutex_unlock(&m_mutex); }
69 bool try_lock() noexcept {
return !pthread_mutex_trylock(&m_mutex); }
71 pthread_mutex_t* native_handle() {
return &m_mutex; }
75 #ifdef __PTHREAD_MUTEX_HAVE_PREV 76 pthread_mutex_t m_mutex = {{0, 0, 0, 0, 0x20, __PTHREAD_SPINS, {0, 0}}};
78 pthread_mutex_t m_mutex = {{0, 0, 0, 0x20, 0, {__PTHREAD_SPINS}}};
namespace to hold default to_json function
Definition: json_binary_writer.cpp:39