diff options
author | bjormel <bjormel@yahooinc.com> | 2023-10-26 13:59:28 +0000 |
---|---|---|
committer | bjormel <bjormel@yahooinc.com> | 2023-10-26 13:59:28 +0000 |
commit | 567be9a1f6353cec41c23bfd1fcd46b4b2a4d2d7 (patch) | |
tree | 4664a743e166a5e11aee7b9acd70ad8ee2617612 /storage/src/vespa/storage/common/storagelinkqueued.hpp | |
parent | e9058b555d4dfea2f6c872d9a677e8678b569569 (diff) | |
parent | bce3b8e926bf9da880172acbe1ba4b12d5e026d6 (diff) |
Merge branch 'master' into bjormel/aws-main-controllerbjormel/aws-main-controller
Diffstat (limited to 'storage/src/vespa/storage/common/storagelinkqueued.hpp')
-rw-r--r-- | storage/src/vespa/storage/common/storagelinkqueued.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/storage/src/vespa/storage/common/storagelinkqueued.hpp b/storage/src/vespa/storage/common/storagelinkqueued.hpp index 01b6ae4a370..7c477bfa84d 100644 --- a/storage/src/vespa/storage/common/storagelinkqueued.hpp +++ b/storage/src/vespa/storage/common/storagelinkqueued.hpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once @@ -14,11 +14,11 @@ namespace storage { template<typename Message> void -StorageLinkQueued::Dispatcher<Message>::terminate() { +StorageLinkQueued::Dispatcher<Message>::shutdown() { if (_thread) { _thread->interrupt(); { - std::lock_guard<std::mutex> guard(_sync); + std::lock_guard guard(_sync); _syncCond.notify_one(); } _thread->join(); @@ -43,7 +43,7 @@ StorageLinkQueued::Dispatcher<Message>::Dispatcher(StorageLinkQueued& parent, un template<typename Message> StorageLinkQueued::Dispatcher<Message>::~Dispatcher() { - terminate(); + shutdown(); } template<typename Message> @@ -56,7 +56,7 @@ void StorageLinkQueued::Dispatcher<Message>::start() template<typename Message> void StorageLinkQueued::Dispatcher<Message>::add(const std::shared_ptr<Message>& m) { - std::unique_lock<std::mutex> guard(_sync); + std::unique_lock guard(_sync); if ( ! _thread) start(); while ((_messages.size() > _maxQueueSize) && !_thread->interrupted()) { @@ -73,7 +73,7 @@ void StorageLinkQueued::Dispatcher<Message>::run(framework::ThreadHandle& h) h.registerTick(framework::PROCESS_CYCLE); std::shared_ptr<Message> message; { - std::unique_lock<std::mutex> guard(_sync); + std::unique_lock guard(_sync); while (!h.interrupted() && _messages.empty()) { _syncCond.wait_for(guard, 100ms); h.registerTick(framework::WAIT_CYCLE); @@ -94,7 +94,7 @@ void StorageLinkQueued::Dispatcher<Message>::run(framework::ThreadHandle& h) { // Since flush() only waits for stack to be empty, we must // pop stack AFTER send have been called. - std::lock_guard<std::mutex> guard(_sync); + std::lock_guard guard(_sync); _messages.pop_front(); _syncCond.notify_one(); } @@ -106,7 +106,7 @@ template<typename Message> void StorageLinkQueued::Dispatcher<Message>::flush() { using namespace std::chrono_literals; - std::unique_lock<std::mutex> guard(_sync); + std::unique_lock guard(_sync); while (!_messages.empty()) { _syncCond.wait_for(guard, 100ms); } |