10 struct scheduler_t :
public std::enable_shared_from_this<scheduler_t>
14 using state_vector = std::vector<state_sptr>;
16 using task_dictionary_type = std::unordered_map<state_base_t*, std::unique_ptr<task_t>>;
19 state_vector _runing_states;
20 state_vector _cached_states;
23 task_dictionary_type _ready_task;
27 task_t* new_task(task_t* task);
54 #ifndef DOXYGEN_SKIP_PROPERTY
55 COMMA_RESUMEF_ENABLE_IF(traits::is_callable_v<_Ty> || traits::is_future_v<_Ty> || traits::is_generator_v<_Ty>)
56 #endif //DOXYGEN_SKIP_PROPERTY
58 #ifndef DOXYGEN_SKIP_PROPERTY
59 RESUMEF_REQUIRES(traits::is_callable_v<_Ty> || traits::is_future_v<_Ty> || traits::is_generator_v<_Ty>)
60 #endif //DOXYGEN_SKIP_PROPERTY
63 if constexpr (traits::is_callable_v<_Ty>)
64 return new_task(
new task_ctx_impl_t<_Ty>(coro));
66 return new_task(
new task_impl_t<_Ty>(coro));
78 scoped_lock<spinlock, spinlock> __guard(_lock_ready, _lock_running);
79 return _ready_task.empty() && _runing_states.empty() && _timer->empty();
90 #ifndef DOXYGEN_SKIP_PROPERTY
94 void add_switch(std::unique_ptr<task_t> task);
109 #endif //DOXYGEN_SKIP_PROPERTY