diff options
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/doom.cpp | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/doom.h | 14 | ||||
-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 |
5 files changed, 17 insertions, 17 deletions
diff --git a/vespalib/src/vespa/vespalib/util/doom.cpp b/vespalib/src/vespa/vespalib/util/doom.cpp index 01ad3aa4e97..227d43ee4c4 100644 --- a/vespalib/src/vespa/vespalib/util/doom.cpp +++ b/vespalib/src/vespa/vespalib/util/doom.cpp @@ -5,7 +5,7 @@ namespace vespalib { Doom::Doom(const Clock &clock, steady_time softDoom, - steady_time hardDoom, bool explicitSoftDoom) + steady_time hardDoom, bool explicitSoftDoom) noexcept : _clock(clock), _softDoom(softDoom), _hardDoom(hardDoom), diff --git a/vespalib/src/vespa/vespalib/util/doom.h b/vespalib/src/vespa/vespalib/util/doom.h index cbac7e2cfbd..a175bbd20df 100644 --- a/vespalib/src/vespa/vespalib/util/doom.h +++ b/vespalib/src/vespa/vespalib/util/doom.h @@ -8,17 +8,17 @@ namespace vespalib { class Doom { public: - Doom(const Clock &clock, steady_time doom) + Doom(const Clock &clock, steady_time doom) noexcept : Doom(clock, doom, doom, false) {} Doom(const Clock &clock, steady_time softDoom, - steady_time hardDoom, bool explicitSoftDoom); + steady_time hardDoom, bool explicitSoftDoom) noexcept; - bool soft_doom() const { return (_clock.getTimeNS() > _softDoom); } - bool hard_doom() const { return (_clock.getTimeNS() > _hardDoom); } - duration soft_left() const { return _softDoom - _clock.getTimeNS(); } - duration hard_left() const { return _hardDoom - _clock.getTimeNS(); } - bool isExplicitSoftDoom() const { return _isExplicitSoftDoom; } + bool soft_doom() const noexcept { return (_clock.getTimeNS() > _softDoom); } + bool hard_doom() const noexcept { return (_clock.getTimeNS() > _hardDoom); } + duration soft_left() const noexcept { return _softDoom - _clock.getTimeNS(); } + duration hard_left() const noexcept { return _hardDoom - _clock.getTimeNS(); } + bool isExplicitSoftDoom() const noexcept { return _isExplicitSoftDoom; } private: const Clock &_clock; steady_time _softDoom; 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(); |