mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21: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) 2011-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2011-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. */
|
||||
@@ -62,7 +62,7 @@ auto SendableChooser<T>::GetSelected()
|
||||
-> decltype(_unwrap_smart_ptr(m_choices[""])) {
|
||||
std::string selected = m_defaultChoice;
|
||||
{
|
||||
std::lock_guard<wpi::mutex> lock(m_mutex);
|
||||
std::lock_guard lock(m_mutex);
|
||||
if (m_haveSelected) selected = m_selected;
|
||||
}
|
||||
if (selected.empty()) {
|
||||
@@ -99,7 +99,7 @@ void SendableChooser<T>::InitSendable(SendableBuilder& builder) {
|
||||
builder.AddSmallStringProperty(
|
||||
kActive,
|
||||
[=](wpi::SmallVectorImpl<char>& buf) -> wpi::StringRef {
|
||||
std::lock_guard<wpi::mutex> lock(m_mutex);
|
||||
std::lock_guard lock(m_mutex);
|
||||
if (m_haveSelected) {
|
||||
buf.assign(m_selected.begin(), m_selected.end());
|
||||
return wpi::StringRef(buf.data(), buf.size());
|
||||
@@ -109,11 +109,11 @@ void SendableChooser<T>::InitSendable(SendableBuilder& builder) {
|
||||
},
|
||||
nullptr);
|
||||
{
|
||||
std::lock_guard<wpi::mutex> lock(m_mutex);
|
||||
std::lock_guard lock(m_mutex);
|
||||
m_activeEntries.emplace_back(builder.GetEntry(kActive));
|
||||
}
|
||||
builder.AddStringProperty(kSelected, nullptr, [=](wpi::StringRef val) {
|
||||
std::lock_guard<wpi::mutex> lock(m_mutex);
|
||||
std::lock_guard lock(m_mutex);
|
||||
m_haveSelected = true;
|
||||
m_selected = val;
|
||||
for (auto& entry : m_activeEntries) entry.SetString(val);
|
||||
|
||||
Reference in New Issue
Block a user