X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fwaiter.hpp;h=cdd0913cc13e7f1957d4b493c4c0d9e3bb3265fc;hb=13d03b1e7e910dc0197275764efb6caeed6642aa;hp=7f5c2f171f4e10448e011cff42a0cc7022d05a85;hpb=32670d719327feb585374283a50eeb76ce36b962;p=lttng-tools.git diff --git a/src/common/waiter.hpp b/src/common/waiter.hpp index 7f5c2f171..cdd0913cc 100644 --- a/src/common/waiter.hpp +++ b/src/common/waiter.hpp @@ -14,7 +14,7 @@ #include "macros.hpp" -#include +#include #include #include @@ -23,33 +23,25 @@ namespace synchro { class waiter; class wait_queue; -class waker { +class waker final { friend waiter; public: - waker(const waker&) = default; - waker(waker&&) = default; - waker& operator=(const waker& other) - { - _state = other._state; - return *this; - } - waker& operator=(waker&& other) - { - _state = other._state; - return *this; - } + waker(const waker&) noexcept = default; + waker(waker&&) noexcept = default; + waker& operator=(const waker& other) noexcept = default; + waker& operator=(waker&& other) noexcept = default; void wake(); ~waker() = default; private: - waker(int32_t& state) : _state{ state } + explicit waker(int32_t& state) noexcept : _state{ state } { } - int32_t& _state; + std::reference_wrapper _state; }; class waiter final {