YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
atomic_event.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <yaclib/fwd.hpp>
4#include <yaclib/util/ref.hpp>
5
6#include <yaclib_std/atomic>
7
8namespace yaclib::detail {
9
11 public:
12 using Token = Unit;
13
14 static Token Make() noexcept;
15
16 void Wait(Token) noexcept;
17
18 void Set() noexcept;
19
20 void Reset() noexcept;
21
22#if !defined(_LIBCPP_VERSION) || defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
23 using wait_t = std::int32_t;
24#else
25 using wait_t = std::int64_t;
26#endif
27 private:
28 yaclib_std::atomic<wait_t> _state = 0;
29};
30
31} // namespace yaclib::detail
static Token Make() noexcept
void Wait(Token) noexcept
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25