25 template<
typename... Args>
27 explicit worker(Args&&... args)
28 : m_strategy(std::forward<Args>(args)...)
32 worker(
const worker&) =
default;
33 worker(worker&&)
noexcept =
default;
36 void schedule(Fn&& fn, Handler&& handler, Args&&... args)
const
38 schedule(duration{}, std::forward<Fn>(fn), std::forward<Handler>(handler), std::forward<Args>(args)...);
42 void schedule(
const duration delay, Fn&& fn, Handler&& handler, Args&&... args)
const
45 m_strategy.defer_for(delay, std::forward<Fn>(fn), std::forward<Handler>(handler), std::forward<Args>(args)...);
47 schedule(now() + delay, std::forward<Fn>(fn), std::forward<Handler>(handler), std::forward<Args>(args)...);
51 void schedule(
const time_point tp, Fn&& fn, Handler&& handler, Args&&... args)
const
54 m_strategy.defer_to(tp, std::forward<Fn>(fn), std::forward<Handler>(handler), std::forward<Args>(args)...);
56 schedule(tp - now(), std::forward<Fn>(fn), std::forward<Handler>(handler), std::forward<Args>(args)...);
59 static rpp::schedulers::time_point now() {
return Strategy::now(); }
62 RPP_NO_UNIQUE_ADDRESS Strategy m_strategy;