diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-12-03 19:46:21 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-12-03 19:46:35 +0100 |
commit | 13148035ce5843881e89f14ad2d644ac58a1b7ef (patch) | |
tree | d16f988e92abbe6580e77de8220e3f7d41e893c9 /searchcore | |
parent | 54e2f0d40cad9ee1d442963e4dc765796fbac96b (diff) |
Use std::atomic.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp | 4 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/querylimiter.h | 2 |
2 files changed, 3 insertions, 3 deletions
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<std::mutex> 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; |