mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Remove template types from lock RAII wrapper usages (#1756)
C++17 has template type autodeduction. These wrappers include std::lock_guard and std::unique_lock.
This commit is contained in:
committed by
Peter Johnson
parent
e582518bae
commit
841ef5d739
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2015-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2015-2019 FIRST. All Rights Reserved. */
|
||||
/* 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. */
|
||||
@@ -43,7 +43,7 @@ InstanceImpl* InstanceImpl::Get(int inst) {
|
||||
}
|
||||
|
||||
// slow path
|
||||
std::lock_guard<wpi::mutex> lock(s_mutex);
|
||||
std::lock_guard lock(s_mutex);
|
||||
|
||||
// static fast-path block
|
||||
if (static_cast<unsigned int>(inst) <
|
||||
@@ -66,7 +66,7 @@ int InstanceImpl::GetDefaultIndex() {
|
||||
if (inst >= 0) return inst;
|
||||
|
||||
// slow path
|
||||
std::lock_guard<wpi::mutex> lock(s_mutex);
|
||||
std::lock_guard lock(s_mutex);
|
||||
|
||||
// double-check
|
||||
inst = s_default;
|
||||
@@ -79,7 +79,7 @@ int InstanceImpl::GetDefaultIndex() {
|
||||
}
|
||||
|
||||
int InstanceImpl::Alloc() {
|
||||
std::lock_guard<wpi::mutex> lock(s_mutex);
|
||||
std::lock_guard lock(s_mutex);
|
||||
return AllocImpl();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ int InstanceImpl::AllocImpl() {
|
||||
}
|
||||
|
||||
void InstanceImpl::Destroy(int inst) {
|
||||
std::lock_guard<wpi::mutex> lock(s_mutex);
|
||||
std::lock_guard lock(s_mutex);
|
||||
if (inst < 0 || static_cast<unsigned int>(inst) >= s_instances.size()) return;
|
||||
|
||||
if (static_cast<unsigned int>(inst) <
|
||||
|
||||
Reference in New Issue
Block a user