summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-01-14 21:13:18 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-01-14 21:35:58 +0000
commit04465fd7fffc974cfdb767f966e92483cac381fb (patch)
tree3f902f2cc53f17d32b70ff1cff16860fd24d7a45 /vespalib
parentcdb9ece95aeae9861ec5aad31c168575919ec346 (diff)
Move idestructorcallback.h to vespalib module and search::IDestructorCallback to vespalib::IdestructorCallback.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/util/idestructorcallback.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/util/idestructorcallback.h b/vespalib/src/vespa/vespalib/util/idestructorcallback.h
new file mode 100644
index 00000000000..7b1dd9ed7f5
--- /dev/null
+++ b/vespalib/src/vespa/vespalib/util/idestructorcallback.h
@@ -0,0 +1,22 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#pragma once
+
+#include <memory>
+
+namespace vespalib {
+
+/**
+ * Interface for class that performs a callback when instance is
+ * destroyed. Typically a shared pointer to an instance is passed
+ * around to multiple worker threads that performs portions of a
+ * larger task before dropping the shared pointer, triggering the
+ * callback when all worker threads have completed.
+ */
+class IDestructorCallback
+{
+public:
+ using SP = std::shared_ptr<IDestructorCallback>;
+ virtual ~IDestructorCallback() = default;
+};
+
+} // namespace search