diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-01-13 14:26:01 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-01-13 14:26:01 +0000 |
commit | 280745a1bd295898024de84e3eaf4eebf2bdc6b5 (patch) | |
tree | 678f317a56849ccbc10d27cfaa97cd8580059c38 /staging_vespalib | |
parent | d022bfb22dede8dd5c9c52a837685fa07a5058cf (diff) |
Use else instead of initializing to 0
Diffstat (limited to 'staging_vespalib')
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp index 0258f7a2e5c..21ed90c3d22 100644 --- a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp @@ -60,7 +60,7 @@ SingleExecutor::sleepProducer(Lock & lock, duration maxWaitTime, uint64_t wakeup Executor::Task::UP SingleExecutor::execute(Task::UP task) { - uint64_t wp(0); + uint64_t wp; { Lock guard(_mutex); if (_closed) { @@ -69,6 +69,8 @@ SingleExecutor::execute(Task::UP task) { task = wait_for_room_or_put_in_overflow_Q(guard, std::move(task)); if (task) { wp = move_to_main_q(guard, std::move(task)); + } else { + wp = _wp.load(std::memory_order_relaxed) + num_tasks_in_overflow_q(guard); } } if (wp == _wakeupConsumerAt.load(std::memory_order_relaxed)) { |