#include "macros.hpp"
-#include <stdbool.h>
+#include <functional>
#include <stdint.h>
#include <urcu/wfstack.h>
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 {