RxCpp
The Reactive Extensions for Native (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++.
Classes | Namespaces | Macros | Functions
rx-timeout.hpp File Reference

Return an observable that terminates with timeout_error if a particular timespan has passed without emitting another item from the source observable. More...

#include "../rx-includes.hpp"
Include dependency graph for rx-timeout.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  rxcpp::timeout_error
 
struct  rxcpp::member_overload< timeout_tag >
 

Namespaces

 rxcpp
 
 rxcpp::operators
 

Macros

#define RXCPP_OPERATORS_RX_TIMEOUT_HPP
 

Functions

template<class... AN>
auto rxcpp::operators::timeout (AN &&...an) -> operator_factory< timeout_tag, AN... >
 Return an observable that terminates with timeout_error if a particular timespan has passed without emitting another item from the source observable. More...
 

Detailed Description

Return an observable that terminates with timeout_error if a particular timespan has passed without emitting another item from the source observable.

Template Parameters
Durationthe type of time interval.
Coordinationthe type of the scheduler (optional).
Parameters
periodthe period of time wait for another item from the source observable.
coordinationthe scheduler to manage timeout for each event (optional).
Returns
Observable that terminates with an error if a particular timespan has passed without emitting another item from the source observable.
Sample Code
using namespace std::chrono;
auto values = rxcpp::observable<>::interval(milliseconds(100))
.take(3)
.concat(rxcpp::observable<>::interval(milliseconds(500)))
.timeout(milliseconds(200));
values.
[](long v) { printf("OnNext: %ld\n", v); },
[](std::exception_ptr ep) {
try {
std::rethrow_exception(ep);
} catch (const rxcpp::timeout_error& ex) {
printf("OnError: %s\n", ex.what());
}
},
[]() { printf("OnCompleted\n"); });
OnNext: 1
OnNext: 2
OnNext: 3
OnNext: 1
OnError: timeout has occurred

Macro Definition Documentation

#define RXCPP_OPERATORS_RX_TIMEOUT_HPP