diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-01-11 09:24:56 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-01-11 09:24:56 +0000 |
commit | 08708ba6add14d390c12b01805f4addc3df0507d (patch) | |
tree | e33643cf77872763795e6350229e76cec2883bb0 /storage | |
parent | 59fdfabc4b6f1e828043cf470ec55ff947d5ce46 (diff) |
Only wake up a waiting thread if doing so would possibly result in success
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/persistence/shared_operation_throttler.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/storage/src/vespa/storage/persistence/shared_operation_throttler.cpp b/storage/src/vespa/storage/persistence/shared_operation_throttler.cpp index 002c4a94387..4c0fadc74b1 100644 --- a/storage/src/vespa/storage/persistence/shared_operation_throttler.cpp +++ b/storage/src/vespa/storage/persistence/shared_operation_throttler.cpp @@ -149,7 +149,8 @@ DynamicOperationThrottler::release_one() noexcept { std::unique_lock lock(_mutex); subtract_one_from_active_window_size(); - if (_waiting_threads > 0) { + // Only wake up a waiting thread if doing so would possibly result in success. + if ((_waiting_threads > 0) && has_spare_capacity_in_active_window()) { lock.unlock(); _cond.notify_one(); } |