Fix: waiter: use std::reference_wrapper instead of a raw reference
[lttng-tools.git] / src / common / waiter.hpp
index 7f5c2f171f4e10448e011cff42a0cc7022d05a85..09823dd4f94a6ec3c74032abc86be23cace3b48d 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "macros.hpp"
 
-#include <stdbool.h>
+#include <functional>
 #include <stdint.h>
 #include <urcu/wfstack.h>
 
@@ -29,16 +29,8 @@ class waker {
 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& operator=(const waker& other) = default;
+       waker& operator=(waker&& other) = default;
 
        void wake();
 
@@ -49,7 +41,7 @@ private:
        {
        }
 
-       int32_t& _state;
+       std::reference_wrapper<int32_t> _state;
 };
 
 class waiter final {
This page took 0.024567 seconds and 4 git commands to generate.