immediately calls provided schedulable or waits for time_point (in the caller-thread)
More...
#include <immediate.hpp>
immediately calls provided schedulable or waits for time_point (in the caller-thread)
- Example
auto worker = rpp::schedulers::immediate::create_worker();
{
std::cout << "Task 1 starts" << std::endl;
{
std::cout << "Task 2 starts" << std::endl;
worker.schedule([](
const auto&)
{
std::cout << "Task 4" << std::endl;
return rpp::schedulers::optional_delay_from_now{};
}, handler);
std::cout << "Task 2 ends" << std::endl;
return rpp::schedulers::optional_delay_from_now{};
}, handler);
worker.schedule([](const auto&)
{
std::cout << "Task 3" << std::endl;
return rpp::schedulers::optional_delay_from_now{};
}, handler);
std::cout << "Task 1 ends" << std::endl;
return rpp::schedulers::optional_delay_from_now{};
}, handler);
Would lead to:
- "Task 1 starts"
- "Task 2 starts"
- "Task 4"
- "Task 2 ends"
- "Task 3"
- "Task 1 ends"
- Examples
- from.cpp, interval.cpp, just.cpp, thread_pool.cpp, and timeout.cpp.
The documentation for this class was generated from the following file: