librf

def.h
1 #pragma once
2
3 #define LIB_RESUMEF_VERSION 20909 // 2.9.9
4
5 namespace resumef
6 {
7 #ifndef DOXYGEN_SKIP_PROPERTY
8 struct scheduler_t;
9
10 template<class _Ty = void>
11 struct [[nodiscard]] future_t;
12
13 using future_vt [[deprecated]] = future_t<>;
14
15 template <typename _Ty = std::nullptr_t, typename _Alloc = std::allocator<char>>
16 struct generator_t;
17
18 template<class _Ty = void>
19 struct promise_t;
20
21 template<class _Ty = void>
22 struct awaitable_t;
23
24 struct state_base_t;
25
26 struct switch_scheduler_t;
27 #endif //DOXYGEN_SKIP_PROPERTY
28
29 template<typename _PromiseT = void>
30 using coroutine_handle = std::experimental::coroutine_handle<_PromiseT>;
31 using suspend_always = std::experimental::suspend_always;
32 using suspend_never = std::experimental::suspend_never;
33
34 template<class... _Mutexes>
35 using scoped_lock = std::scoped_lock<_Mutexes...>;
36
40 constexpr size_t _Version = LIB_RESUMEF_VERSION;
41
45 scheduler_t* this_scheduler();
46
47 }
48
49 #ifndef DOXYGEN_SKIP_PROPERTY
50
51 #if RESUMEF_DEBUG_COUNTER
52 extern std::mutex g_resumef_cout_mutex;
53 extern std::atomic<intptr_t> g_resumef_state_count;
54 extern std::atomic<intptr_t> g_resumef_task_count;
55 extern std::atomic<intptr_t> g_resumef_evtctx_count;
56 extern std::atomic<intptr_t> g_resumef_state_id;
57 #endif
58
59 namespace resumef
60 {
61 template<class T>
62 struct remove_cvref
63 {
64 typedef std::remove_cv_t<std::remove_reference_t<T>> type;
65 };
66 template<class T>
67 using remove_cvref_t = typename remove_cvref<T>::type;
68
69
70 template<class _Ty>
71 constexpr size_t _Align_size()
72 {
73 const size_t _ALIGN_REQ = sizeof(void*) * 2;
74 return std::is_empty_v<_Ty> ? 0 :
75 (sizeof(_Ty) + _ALIGN_REQ - 1) & ~(_ALIGN_REQ - 1);
76 }
77 }
78
79 #include "exception.inl"
80
81 #endif //DOXYGEN_SKIP_PROPERTY