diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-19 10:10:18 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-19 10:10:18 +0000 |
commit | 672d983232714b980d7366be67df52c83de9c631 (patch) | |
tree | 4166122a72b6d42991c325325bc20c56f62e8e8e /searchlib | |
parent | 677a35028b3aac1b6b7232b470d1fdf2df772a52 (diff) |
Move general purpose destructor callbacks to vespalib.
Diffstat (limited to 'searchlib')
4 files changed, 3 insertions, 47 deletions
diff --git a/searchlib/src/vespa/searchlib/common/CMakeLists.txt b/searchlib/src/vespa/searchlib/common/CMakeLists.txt index 97af7855aea..3de063a70ee 100644 --- a/searchlib/src/vespa/searchlib/common/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/common/CMakeLists.txt @@ -12,7 +12,6 @@ vespa_add_library(searchlib_common OBJECT featureset.cpp fileheadercontext.cpp flush_token.cpp - gatecallback.cpp geo_location.cpp geo_location_spec.cpp geo_location_parser.cpp diff --git a/searchlib/src/vespa/searchlib/common/gatecallback.cpp b/searchlib/src/vespa/searchlib/common/gatecallback.cpp deleted file mode 100644 index 29346d7ad9c..00000000000 --- a/searchlib/src/vespa/searchlib/common/gatecallback.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "gatecallback.h" -#include <vespa/vespalib/util/gate.h> - -namespace search { - -GateCallback::~GateCallback() { - _gate.countDown(); -} - -} diff --git a/searchlib/src/vespa/searchlib/common/gatecallback.h b/searchlib/src/vespa/searchlib/common/gatecallback.h deleted file mode 100644 index eaaa8c4fab9..00000000000 --- a/searchlib/src/vespa/searchlib/common/gatecallback.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include "vespa/vespalib/util/idestructorcallback.h" - -namespace vespalib { class Gate; } - -namespace search { - -class GateCallback : public vespalib::IDestructorCallback { -public: - GateCallback(vespalib::Gate & gate) noexcept : _gate(gate) {} - ~GateCallback() override; -private: - vespalib::Gate & _gate; -}; - -class IgnoreCallback : public vespalib::IDestructorCallback { -public: - IgnoreCallback() noexcept { } - ~IgnoreCallback() override = default; -}; - -template <typename T> -struct KeepAlive : public vespalib::IDestructorCallback { - explicit KeepAlive(T toKeep) noexcept : _toKeep(std::move(toKeep)) { } - ~KeepAlive() override = default; - T _toKeep; -}; - -} // namespace search diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp index 0cebc056569..891f312151b 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp @@ -2,7 +2,7 @@ #include "translogserver.h" #include "domain.h" #include "client_common.h" -#include <vespa/searchlib/common/gatecallback.h> +#include <vespa/vespalib/util/destructor_callbacks.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/exceptions.h> @@ -578,8 +578,8 @@ TransLogServer::domainCommit(FRT_RPCRequest *req) vespalib::Gate gate; { // Need to scope in order to drain out all the callbacks. - domain->append(packet, make_shared<GateCallback>(gate)); - auto keep = domain->startCommit(make_shared<IgnoreCallback>()); + domain->append(packet, make_shared<vespalib::GateCallback>(gate)); + auto keep = domain->startCommit(make_shared<vespalib::IgnoreCallback>()); } gate.await(); ret.AddInt32(0); |