ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
immediate.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2023 - present.
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// https://www.boost.org/LICENSE_1_0.txt)
7//
8// Project home: https://github.com/victimsnino/ReactivePlusPlus
9//
10
11#pragma once
12
13#include <rpp/schedulers/fwd.hpp>
14
15#include <rpp/disposables/disposable_wrapper.hpp>
16#include <rpp/schedulers/details/utils.hpp>
17#include <rpp/schedulers/details/worker.hpp>
18#include <rpp/utils/functors.hpp>
19
20namespace rpp::schedulers
21{
64 class immediate final
65 {
66 public:
68 {
69 public:
70 template<rpp::schedulers::constraint::schedulable_handler Handler, typename... Args, constraint::schedulable_fn<Handler, Args...> Fn>
71 static void defer_for(duration duration, Fn&& fn, Handler&& handler, Args&&... args)
72 {
73 details::immediate_scheduling_while_condition<worker_strategy>(duration, rpp::utils::return_true{}, std::forward<Fn>(fn), std::forward<Handler>(handler), std::forward<Args>(args)...);
74 }
75
76 static rpp::schedulers::time_point now() { return rpp::schedulers::clock_type::now(); }
77 };
78
79 static rpp::schedulers::worker<worker_strategy> create_worker()
80 {
82 }
83 };
84} // namespace rpp::schedulers
immediately calls provided schedulable or waits for time_point (in the caller-thread)
Definition immediate.hpp:65
Definition fwd.hpp:157
Definition functors.hpp:68