From 13148035ce5843881e89f14ad2d644ac58a1b7ef Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Thu, 3 Dec 2020 19:46:21 +0100 Subject: Use std::atomic. --- searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp | 4 ++-- searchcore/src/vespa/searchcore/proton/matching/querylimiter.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'searchcore') diff --git a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp index ba5466700c8..37ab0054851 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp @@ -25,14 +25,14 @@ QueryLimiter::grabToken(const Doom & doom) _cond.wait_for(guard, left); } } - _activeThreads = _activeThreads + 1; + _activeThreads++; } void QueryLimiter::releaseToken() { std::lock_guard guard(_lock); - _activeThreads = _activeThreads - 1; + _activeThreads--; _cond.notify_one(); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.h b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.h index 45783959957..576c5921b61 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.h +++ b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.h @@ -37,7 +37,7 @@ private: void releaseToken(); std::mutex _lock; std::condition_variable _cond; - volatile int _activeThreads; + int _activeThreads; // These are updated asynchronously at reconfig. volatile int _maxThreads; -- cgit v1.2.3