ReactivePlusPlus
ReactiveX implementation for C++20
Toggle main menu visibility
Loading...
Searching...
No Matches
as_blocking.cpp
#include <rpp/rpp.hpp>
#include "rpp/sources/fwd.hpp"
#include <iostream>
int
main()
// NOLINT(bugprone-exception-escape)
{
rpp::source::just
(1)
|
rpp::operators::delay
(std::chrono::seconds{1},
rpp::schedulers::new_thread
{})
// <-- emit from another thread with delay
|
rpp::operators::as_blocking
()
|
rpp::operators::subscribe
([](
int
) { }, []() { std::cout <<
"COMPLETED"
<< std::endl; });
std::cout <<
"done"
<< std::endl;
// output: COMPLETED done
}
rpp::schedulers::new_thread
Scheduler which schedules invoking of schedulables to another thread via queueing tasks with priority...
Definition
new_thread.hpp:31
rpp::source::just
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition
from.hpp:201
rpp::operators::subscribe
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition
subscribe.hpp:226
rpp::operators::as_blocking
auto as_blocking()
Converts rpp::observable to rpp::blocking_observable.
Definition
as_blocking.hpp:47
rpp::operators::delay
auto delay(rpp::schedulers::duration delay_duration, Scheduler &&scheduler)
Shift the emissions from an Observable forward in time by a particular amount.
Definition
delay.hpp:219
Generated by
1.17.0