ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
rpp::schedulers::immediate Class Referencefinal

immediately calls provided schedulable or waits for time_point (in the caller-thread) More...

#include <immediate.hpp>

Classes

class  worker_strategy
 

Static Public Member Functions

static rpp::schedulers::worker< worker_strategycreate_worker ()
 

Detailed Description

immediately calls provided schedulable or waits for time_point (in the caller-thread)

Example
auto worker = rpp::schedulers::immediate::create_worker();
worker.schedule([&worker](const auto& handler)
{
std::cout << "Task 1 starts" << std::endl;
worker.schedule([&worker](const auto& handler)
{
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);
Definition fwd.hpp:157

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: