diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-12-12 12:18:38 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-12-12 12:18:38 +0000 |
commit | 3f54d4088502406eda15288bde29a16f6c810751 (patch) | |
tree | 838d8518e5d65f51e812bc4b4a7a14c67bb3b7a9 /vespalib/src | |
parent | 00f810fa679db282b246d83a3b7b4003a206f722 (diff) |
Wire in thread bundle to execute info and request context.
Diffstat (limited to 'vespalib/src')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp | 10 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/simple_thread_bundle.h | 6 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/thread_bundle.h | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp index 3b56a2bd297..5909c2df8c3 100644 --- a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp +++ b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp @@ -14,33 +14,33 @@ namespace { struct SignalHook : Runnable { Signal &signal; - SignalHook(Signal &s) : signal(s) {} + explicit SignalHook(Signal &s) noexcept : signal(s) {} void run() override { signal.send(); } }; struct BroadcastHook : Runnable { Signal &signal; - BroadcastHook(Signal &s) : signal(s) {} + explicit BroadcastHook(Signal &s) noexcept : signal(s) {} void run() override { signal.broadcast(); } }; struct PartHook : Runnable { Part part; - PartHook(const Part &p) : part(p) {} + explicit PartHook(const Part &p) noexcept : part(p) {} void run() override { part.perform(); } }; struct HookPair : Runnable { Runnable::UP first; Runnable::UP second; - HookPair(Runnable::UP f, Runnable::UP s) : first(std::move(f)), second(std::move(s)) {} + HookPair(Runnable::UP f, Runnable::UP s) noexcept : first(std::move(f)), second(std::move(s)) {} void run() override { first->run(); second->run(); } }; -Runnable::UP wrap(Runnable *runnable) { +Runnable::UP wrap(Runnable *runnable) noexcept { return Runnable::UP(runnable); } diff --git a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h index 9a5ae9dcf6f..9fccbef1f9a 100644 --- a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h +++ b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h @@ -21,7 +21,7 @@ struct Work { Runnable* const* targets; size_t cnt; CountDownLatch *latch; - Work() : targets(nullptr), cnt(0), latch(nullptr) {} + Work() noexcept : targets(nullptr), cnt(0), latch(nullptr) {} }; /** @@ -30,9 +30,9 @@ struct Work { struct Part { const Work &work; size_t offset; - Part(const Work &w, size_t o) : work(w), offset(o) {} + Part(const Work &w, size_t o) noexcept : work(w), offset(o) {} bool valid() const noexcept { return (offset < work.cnt); } - void perform() { + void perform() const { if (valid()) { work.targets[offset]->run(); } diff --git a/vespalib/src/vespa/vespalib/util/thread_bundle.h b/vespalib/src/vespa/vespalib/util/thread_bundle.h index 72f9a0ce368..6a9bbeea0d1 100644 --- a/vespalib/src/vespa/vespalib/util/thread_bundle.h +++ b/vespalib/src/vespa/vespalib/util/thread_bundle.h @@ -64,7 +64,7 @@ struct ThreadBundle { /** * Empty virtual destructor to enable subclassing. **/ - virtual ~ThreadBundle() {} + virtual ~ThreadBundle() = default; // a thread bundle that can only run things in the current thread. static ThreadBundle &trivial(); |