-
Notifications
You must be signed in to change notification settings - Fork 409
Observing on main thread #151
Copy link
Copy link
Closed
Description
In RxAndroid, there's .observeOn(AndroidSchedulers.mainThread()). How do you achieve that in RxCpp?
For example, how do I ensure that the call to printf below is executed on the main thread?
auto numbers = rxcpp::observable<>::range(1, 100).subscribe_on(rxcpp::observe_on_new_thread());
numbers
.map([](int n) { return n * 2; })
.map([](int n) { return n + 1; })
.as_blocking()
.subscribe([](int n)
{
printf("Number: %d\n", n);
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels