aboutsummaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-03-02 11:50:04 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-03-02 11:50:04 +0000
commit6449cf3d52ae44a54de59e478f8c0915671e23bb (patch)
treee55056a68a2891e058b33d00ddfd90b613874b9c /staging_vespalib
parent1908db5022dad66bdf14ea3377a5459eac5534e7 (diff)
Use acquire/release semantics for _rp
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp2
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/singleexecutor.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp
index bf1c41350ee..791b0876c19 100644
--- a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp
@@ -96,7 +96,7 @@ SingleExecutor::run_tasks_till(uint64_t available) {
while (consumed < available) {
Task::UP task = std::move(_tasks[index(consumed)]);
task->run();
- _rp.store(++consumed, std::memory_order_relaxed);
+ _rp.store(++consumed, std::memory_order_release);
if (wakeupLimit == consumed) {
MonitorGuard guard(_producerMonitor);
guard.broadcast();
diff --git a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
index 5bf7ef9fe6f..0ab89355566 100644
--- a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
+++ b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
@@ -36,7 +36,7 @@ private:
}
uint64_t numTasks() const {
- return _wp.load(std::memory_order_relaxed) - _rp.load(std::memory_order_relaxed);
+ return _wp.load(std::memory_order_relaxed) - _rp.load(std::memory_order_acquire);
}
std::atomic<uint32_t> _taskLimit;
std::atomic<uint32_t> _wantedTaskLimit;