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

@@ -63,7 +63,7 @@ class UnlimitedHandleResource : public HandleBase {
template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
THandle UnlimitedHandleResource<THandle, TStruct, enumValue>::Allocate(
std::shared_ptr<TStruct> structure) {
std::lock_guard<wpi::mutex> sync(m_handleMutex);
std::lock_guard<wpi::mutex> lock(m_handleMutex);
size_t i;
for (i = 0; i < m_structures.size(); i++) {
if (m_structures[i] == nullptr) {
@@ -82,7 +82,7 @@ template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
std::shared_ptr<TStruct>
UnlimitedHandleResource<THandle, TStruct, enumValue>::Get(THandle handle) {
int16_t index = getHandleTypedIndex(handle, enumValue, m_version);
std::lock_guard<wpi::mutex> sync(m_handleMutex);
std::lock_guard<wpi::mutex> lock(m_handleMutex);
if (index < 0 || index >= static_cast<int16_t>(m_structures.size()))
return nullptr;
return m_structures[index];
@@ -92,7 +92,7 @@ template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
std::shared_ptr<TStruct>
UnlimitedHandleResource<THandle, TStruct, enumValue>::Free(THandle handle) {
int16_t index = getHandleTypedIndex(handle, enumValue, m_version);
std::lock_guard<wpi::mutex> sync(m_handleMutex);
std::lock_guard<wpi::mutex> lock(m_handleMutex);
if (index < 0 || index >= static_cast<int16_t>(m_structures.size()))
return nullptr;
return std::move(m_structures[index]);
@@ -113,7 +113,7 @@ template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
template <typename Functor>
void UnlimitedHandleResource<THandle, TStruct, enumValue>::ForEach(
Functor func) {
std::lock_guard<wpi::mutex> sync(m_handleMutex);
std::lock_guard<wpi::mutex> lock(m_handleMutex);
size_t i;
for (i = 0; i < m_structures.size(); i++) {
if (m_structures[i] != nullptr) {