YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
atomic_wait.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <yaclib/config.hpp>
5
6namespace yaclib::detail {
7
8template <typename Impl, typename T>
9class AtomicWait : protected Impl {
10 public:
11 using Impl::Impl;
12
13#if YACLIB_FUTEX != 0
14 void wait(T old, std::memory_order order = std::memory_order_seq_cst) const noexcept {
15 YACLIB_INJECT_FAULT(Impl::wait(old, order));
16 }
17 void wait(T old, std::memory_order order = std::memory_order_seq_cst) const volatile noexcept {
18 YACLIB_INJECT_FAULT(Impl::wait(old, order));
19 }
20
21 void notify_one() noexcept {
22 YACLIB_INJECT_FAULT(Impl::notify_one());
23 }
24 void notify_one() volatile noexcept {
25 YACLIB_INJECT_FAULT(Impl::notify_one());
26 }
27
28 void notify_all() noexcept {
29 YACLIB_INJECT_FAULT(Impl::notify_all());
30 }
31 void notify_all() volatile noexcept {
32 YACLIB_INJECT_FAULT(Impl::notify_all());
33 }
34#endif
35};
36
37} // namespace yaclib::detail
#define YACLIB_INJECT_FAULT(statement)
Definition inject.hpp:20
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25