* @example subscribe_on.cpp **/
| 6 | * @example subscribe_on.cpp |
| 7 | **/ |
| 8 | int main() |
| 9 | { |
| 10 | //! [subscribe_on] |
| 11 | std::cout << std::this_thread::get_id() << std::endl; |
| 12 | rpp::source::create<int>([](const auto& sub) { |
| 13 | std::cout << "on_subscribe thread " << std::this_thread::get_id() << std::endl; |
| 14 | sub.on_next(1); |
| 15 | sub.on_completed(); |
| 16 | }) |
| 17 | | rpp::operators::subscribe_on(rpp::schedulers::new_thread{}) |
| 18 | | rpp::operators::as_blocking() |
| 19 | | rpp::operators::subscribe([](int v) { std::cout << "[" << std::this_thread::get_id() << "] : " << v << "\n"; }); |
| 20 | std::cout << std::this_thread::get_id() << std::endl; |
| 21 | |
| 22 | // Template for output: |
| 23 | // TH1 |
| 24 | // on_subscribe thread TH2 |
| 25 | // [TH2]: 1 |
| 26 | // TH1 |
| 27 | //! [subscribe_on] |
| 28 | return 0; |
| 29 | } |
nothing calls this directly
no test coverage detected