Clean-up: modernize pretty_xml.cpp
[lttng-tools.git] / src / common / waiter.hpp
index 7f5c2f171f4e10448e011cff42a0cc7022d05a85..cdd0913cc13e7f1957d4b493c4c0d9e3bb3265fc 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "macros.hpp"
 
-#include <stdbool.h>
+#include <functional>
 #include <stdint.h>
 #include <urcu/wfstack.h>
 
@@ -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<int32_t> _state;
 };
 
 class waiter final {
This page took 0.023025 seconds and 4 git commands to generate.