Subscription and unsubscription are queued and delivered using the scheduler from the supplied coordination.
More...
Go to the source code of this file.
Subscription and unsubscription are queued and delivered using the scheduler from the supplied coordination.
- Template Parameters
-
Coordination | the type of the scheduler. |
- Parameters
-
cn | the scheduler to perform subscription actions on. |
- Returns
- The source observable modified so that its subscriptions happen on the specified scheduler.
- Sample Code\n
printf("[thread %s] Start task\n", get_pid().c_str());
printf("[thread %s] Emit value %d\n", get_pid().c_str(), v);
return v;
});
values.
[](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
printf("[thread %s] Finish task\n", get_pid().c_str());
[thread 3070107664] Start task
[thread 2967462976] Emit value 1
[thread 2967462976] OnNext: 1
[thread 2967462976] Emit value 2
[thread 2967462976] OnNext: 2
[thread 2967462976] Emit value 3
[thread 2967462976] OnNext: 3
[thread 2967462976] OnCompleted
[thread 3070107664] Finish task
Invoking rxcpp::observable::observe_on operator, instead of subscribe_on, gives following results: [thread 3070107664] Start task
[thread 3070107664] Emit value 1
[thread 3070107664] Emit value 2
[thread 3070107664] Emit value 3
[thread 3015701568] OnNext: 1
[thread 3015701568] OnNext: 2
[thread 3015701568] OnNext: 3
[thread 3015701568] OnCompleted
[thread 3070107664] Finish task
◆ RXCPP_OPERATORS_RX_SUBSCRIBE_ON_HPP
#define RXCPP_OPERATORS_RX_SUBSCRIBE_ON_HPP |
auto range(T first=0, T last=std::numeric_limits< T >::max(), std::ptrdiff_t step=1) -> observable< T, detail::range< T, identity_one_worker >>
Definition: rx-range.hpp:119