You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have several asynchronous subscriptions in the UI that I'm using Observable.FromAsync on to deal with concurrency. One thing that I can't quite figure out is relating to the overload of FromAsync that contains the scheduler.
That contains a sync part _SyncUpdate that I want to update the UI with and an async part _DoAsync that is awaited (can be run on any thread). I set up my subscriptions as follows:
Will ObserveOn ensure that the synchronous part of _AsyncMethod is run on the supplied UIScheduler, while _DoAsync can run on whichever other thread?
Or is it necessary to use the overload of FromAsync that contains the scheduler as well to make sure the synchronous part is run on the UI thread, such that the code should look like this?
Or should synchronous parts never be run inside Observable.FromAsync, so it only contains asynchronous calls?
Finally, if _DoAsync is awaited with ConfigureAwait(true) (explicitly written here for clarity), will it return to the synchronization context specified by the scheduler after the async part finishes?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have several asynchronous subscriptions in the UI that I'm using Observable.FromAsync on to deal with concurrency. One thing that I can't quite figure out is relating to the overload of FromAsync that contains the scheduler.
Lets say that I have an async method:
That contains a sync part _SyncUpdate that I want to update the UI with and an async part _DoAsync that is awaited (can be run on any thread). I set up my subscriptions as follows:
Here are the questions:
Beta Was this translation helpful? Give feedback.
All reactions