From 0959f9be88e082f1d75144092d3b448f28abc75a Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 31 Oct 2018 09:21:23 -0700 Subject: [PATCH] use epicsGuard --- src/remote/channelSearchManager.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/remote/channelSearchManager.cpp b/src/remote/channelSearchManager.cpp index 778db42..39728ce 100644 --- a/src/remote/channelSearchManager.cpp +++ b/src/remote/channelSearchManager.cpp @@ -346,15 +346,17 @@ void ChannelSearchManager::callback() vector::iterator siter = toSend.begin(); for (; siter != toSend.end(); siter++) { - m_userValueMutex.lock(); - int32_t& countValue = (*siter)->getUserValue(); - bool skip = !isPowerOfTwo(countValue); + bool skip; + { + epicsGuard G(m_userValueMutex); + int32_t& countValue = (*siter)->getUserValue(); + skip = !isPowerOfTwo(countValue); - if (countValue >= MAX_COUNT_VALUE) - countValue = MAX_FALLBACK_COUNT_VALUE; - else - countValue++; - m_userValueMutex.unlock(); + if (countValue >= MAX_COUNT_VALUE) + countValue = MAX_FALLBACK_COUNT_VALUE; + else + countValue++; + } // back-off if (skip)