Remove priority mutex (#644)

* Removed hal::priority_condition_variable

* Replaced uses of priority mutexes with std::mutex and std::recursive_mutex

This allowed replacing a use of std::condition_variable_any with
std::condition_variable.

* Replaced all uses of std::recursive_mutex with std::mutex equivalents
This commit is contained in:
Tyler Veness
2017-09-28 23:32:35 -07:00
committed by Peter Johnson
parent 19addb04cf
commit dd66b23845
44 changed files with 390 additions and 746 deletions

View File

@@ -83,7 +83,7 @@ double Timer::Get() const {
double result;
double currentTime = GetFPGATimestamp();
std::lock_guard<hal::priority_mutex> sync(m_mutex);
std::lock_guard<std::mutex> sync(m_mutex);
if (m_running) {
// If the current time is before the start time, then the FPGA clock
// rolled over. Compensate by adding the ~71 minutes that it takes
@@ -107,7 +107,7 @@ double Timer::Get() const {
* now.
*/
void Timer::Reset() {
std::lock_guard<hal::priority_mutex> sync(m_mutex);
std::lock_guard<std::mutex> sync(m_mutex);
m_accumulatedTime = 0;
m_startTime = GetFPGATimestamp();
}
@@ -119,7 +119,7 @@ void Timer::Reset() {
* relative to the system clock.
*/
void Timer::Start() {
std::lock_guard<hal::priority_mutex> sync(m_mutex);
std::lock_guard<std::mutex> sync(m_mutex);
if (!m_running) {
m_startTime = GetFPGATimestamp();
m_running = true;
@@ -136,7 +136,7 @@ void Timer::Start() {
void Timer::Stop() {
double temp = Get();
std::lock_guard<hal::priority_mutex> sync(m_mutex);
std::lock_guard<std::mutex> sync(m_mutex);
if (m_running) {
m_accumulatedTime = temp;
m_running = false;
@@ -153,7 +153,7 @@ void Timer::Stop() {
*/
bool Timer::HasPeriodPassed(double period) {
if (Get() > period) {
std::lock_guard<hal::priority_mutex> sync(m_mutex);
std::lock_guard<std::mutex> sync(m_mutex);
// Advance the start time by the period.
m_startTime += period;
// Don't set it to the current time... we want to avoid drift.