Cleaned up variable names for std::lock_guard and their associated mutexes (#759)

This commit is contained in:
Tyler Veness
2017-11-22 17:10:21 -08:00
committed by Peter Johnson
parent 96de0b5b11
commit ba879f4663
22 changed files with 136 additions and 137 deletions

View File

@@ -80,7 +80,7 @@ double Timer::Get() const {
double result;
double currentTime = GetFPGATimestamp();
std::lock_guard<wpi::mutex> sync(m_mutex);
std::lock_guard<wpi::mutex> lock(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 to roll over to
@@ -104,7 +104,7 @@ double Timer::Get() const {
* now.
*/
void Timer::Reset() {
std::lock_guard<wpi::mutex> sync(m_mutex);
std::lock_guard<wpi::mutex> lock(m_mutex);
m_accumulatedTime = 0;
m_startTime = GetFPGATimestamp();
}
@@ -116,7 +116,7 @@ void Timer::Reset() {
* relative to the system clock.
*/
void Timer::Start() {
std::lock_guard<wpi::mutex> sync(m_mutex);
std::lock_guard<wpi::mutex> lock(m_mutex);
if (!m_running) {
m_startTime = GetFPGATimestamp();
m_running = true;
@@ -133,7 +133,7 @@ void Timer::Start() {
void Timer::Stop() {
double temp = Get();
std::lock_guard<wpi::mutex> sync(m_mutex);
std::lock_guard<wpi::mutex> lock(m_mutex);
if (m_running) {
m_accumulatedTime = temp;
m_running = false;
@@ -150,7 +150,7 @@ void Timer::Stop() {
*/
bool Timer::HasPeriodPassed(double period) {
if (Get() > period) {
std::lock_guard<wpi::mutex> sync(m_mutex);
std::lock_guard<wpi::mutex> lock(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.