2016-01-02 03:02:34 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2017-01-01 01:05:57 -07:00
|
|
|
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2015-06-25 01:54:20 -07:00
|
|
|
#include "HAL/cpp/priority_mutex.h"
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
void priority_recursive_mutex::lock() { pthread_mutex_lock(&m_mutex); }
|
2015-06-25 01:54:20 -07:00
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
void priority_recursive_mutex::unlock() { pthread_mutex_unlock(&m_mutex); }
|
2015-06-25 01:54:20 -07:00
|
|
|
|
|
|
|
|
bool priority_recursive_mutex::try_lock() noexcept {
|
|
|
|
|
return !pthread_mutex_trylock(&m_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
pthread_mutex_t* priority_recursive_mutex::native_handle() { return &m_mutex; }
|
2015-06-25 01:54:20 -07:00
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
void priority_mutex::lock() { pthread_mutex_lock(&m_mutex); }
|
2015-06-25 01:54:20 -07:00
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
void priority_mutex::unlock() { pthread_mutex_unlock(&m_mutex); }
|
2015-06-25 01:54:20 -07:00
|
|
|
|
|
|
|
|
bool priority_mutex::try_lock() noexcept {
|
|
|
|
|
return !pthread_mutex_trylock(&m_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
pthread_mutex_t* priority_mutex::native_handle() { return &m_mutex; }
|