diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-03 12:54:47 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-03 12:54:47 +0000 |
commit | 21a8f623154b544c2218a45b42294cb89967ed4a (patch) | |
tree | 9f73c4ca27a876498af2bf46b416dc5c6247a21a /vespalib | |
parent | addf3a5cbece1956f95494490246ac6a90cc9885 (diff) |
Use a reference instead of a pointer, as it will always be present now.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/invokeservice/invokeservice_test.cpp | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/invokeserviceimpl.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/vespalib/src/tests/invokeservice/invokeservice_test.cpp b/vespalib/src/tests/invokeservice/invokeservice_test.cpp index bfd33cd7cca..4b987839e50 100644 --- a/vespalib/src/tests/invokeservice/invokeservice_test.cpp +++ b/vespalib/src/tests/invokeservice/invokeservice_test.cpp @@ -34,7 +34,7 @@ TEST("require that now is moving forward") { InvokeCounter a; InvokeServiceImpl service(1ms); EXPECT_EQUAL(0u, a._count); - auto ra = service.registerInvoke([&prev, &a, now=service.nowPtr() ]() noexcept { + auto ra = service.registerInvoke([&prev, &a, now= service.nowRef() ]() noexcept { EXPECT_GREATER(now->load(), prev); prev = now->load(); a.inc(); diff --git a/vespalib/src/vespa/vespalib/util/invokeserviceimpl.h b/vespalib/src/vespa/vespalib/util/invokeserviceimpl.h index 2448e381610..beb57ca1ce0 100644 --- a/vespalib/src/vespa/vespalib/util/invokeserviceimpl.h +++ b/vespalib/src/vespa/vespalib/util/invokeserviceimpl.h @@ -20,7 +20,7 @@ public: InvokeServiceImpl & operator=(const InvokeServiceImpl &) = delete; ~InvokeServiceImpl() override; std::unique_ptr<IDestructorCallback> registerInvoke(InvokeFunc func) override; - const std::atomic<steady_time> * nowPtr() const { return &_now; } + const std::atomic<steady_time> & nowRef() const { return _now; } private: using IdAndFunc = std::pair<uint64_t, InvokeFunc>; class Registration; |