diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-05-10 14:03:44 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-05-10 14:03:44 +0000 |
commit | 3adf24a4a850035770f2d902756bf356ae768928 (patch) | |
tree | dacd33b2a532116e3505d574084ec1c3cde2f336 | |
parent | 2d494f501a4d342cacdb1e055e281a31e4b0d911 (diff) |
Explicitly signal locking requirements in function signature
-rw-r--r-- | storage/src/vespa/storage/distributor/distributor.cpp | 4 | ||||
-rw-r--r-- | storage/src/vespa/storage/distributor/distributor.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/storage/src/vespa/storage/distributor/distributor.cpp b/storage/src/vespa/storage/distributor/distributor.cpp index 67b264041a3..f7ecd324a51 100644 --- a/storage/src/vespa/storage/distributor/distributor.cpp +++ b/storage/src/vespa/storage/distributor/distributor.cpp @@ -606,7 +606,7 @@ Distributor::notify_stripe_wants_to_send_host_info(uint16_t stripe_index) } bool -Distributor::may_send_host_info_on_behalf_of_stripes() noexcept +Distributor::may_send_host_info_on_behalf_of_stripes([[maybe_unused]] std::lock_guard<std::mutex>& held_lock) noexcept { bool any_stripe_wants_to_send = false; for (const auto& stats : _stripe_scan_stats) { @@ -628,7 +628,7 @@ Distributor::send_host_info_if_appropriate() const auto now = _component.getClock().getMonotonicTime(); std::lock_guard lock(_stripe_scan_notify_mutex); - if (may_send_host_info_on_behalf_of_stripes()) { + if (may_send_host_info_on_behalf_of_stripes(lock)) { if ((now - _last_host_info_send_time) >= _host_info_send_delay) { LOG(debug, "Sending GetNodeState replies to cluster controllers on behalf of stripes"); _component.getStateUpdater().immediately_send_get_node_state_replies(); diff --git a/storage/src/vespa/storage/distributor/distributor.h b/storage/src/vespa/storage/distributor/distributor.h index 7e5de38ffe8..b6dbc4432eb 100644 --- a/storage/src/vespa/storage/distributor/distributor.h +++ b/storage/src/vespa/storage/distributor/distributor.h @@ -186,7 +186,7 @@ private: void process_fetched_external_messages(); void send_host_info_if_appropriate(); // Precondition: _stripe_scan_notify_mutex is held - [[nodiscard]] bool may_send_host_info_on_behalf_of_stripes() noexcept; + [[nodiscard]] bool may_send_host_info_on_behalf_of_stripes(std::lock_guard<std::mutex>& held_lock) noexcept; struct StripeScanStats { bool wants_to_send_host_info = false; |