#include <rpp/rpp.hpp>
#include <chrono>
#include <ctime>
#include <iostream>
int main()
{
auto start = rpp::schedulers::clock_type::now();
rpp::source::just(1, 2, 3)
.do_on_next([&](auto&& v)
{
auto emitting_time = rpp::schedulers::clock_type::now();
std::cout << "emit " << v << " in thread{" << std::this_thread::get_id() << "} duration since start " << std::chrono::duration_cast<std::chrono::seconds>(emitting_time - start).count() << "s"<< std::endl;
})
.as_blocking()
.subscribe([&](int v)
{
auto observing_time = rpp::schedulers::clock_type::now();
std::cout << "observe " << v << " in thread{" << std::this_thread::get_id() << "} duration since start " << std::chrono::duration_cast<std::chrono::seconds>(observing_time - start).count() <<"s" << std::endl;
});
return 0;
}
scheduler which schedules execution of schedulables via queueing tasks to another thread with priorit...
Definition: new_thread_scheduler.hpp:32