X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fwaiter.hpp;h=75c9ac447da2ce1320c9bf6c26d5a1b458abc7c1;hb=HEAD;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 {