12#include <rpp/schedulers/constraints.hpp>
13#include <rpp/subscriptions/subscription_base.hpp>
17namespace rpp::schedulers::details
20inline thread_local time_point s_last_sleep_timepoint{};
26bool immediate_scheduling_while_condition(time_point& time_point,
27 constraint::schedulable_fn
auto&& schedulable,
28 const subscription_base& sub,
29 const std::predicate
auto& condition)
33 if (!sub.is_subscribed())
36 if (s_last_sleep_timepoint < time_point)
38 std::this_thread::sleep_until(time_point);
39 s_last_sleep_timepoint = time_point;
41 if (!sub.is_subscribed())
46 if (
const auto duration = schedulable())
47 time_point = time_point + duration.value();