Reactive Framework (RX) and dealing with events Asynchronously

穿精又带淫゛_ 提交于 2019-12-06 01:02:03
bufferedEvents.ObserveOn(Scheduler.TaskPool).Subscribe(...

SubscribeOn is to specify the schedule on which so-called "subscription side effects" are happening. For example, your observable can open a file each time somebody subscribes.

ObserveOn is to specify the schedule on which the call to the observer will happen every time when there is a new value. In practice, it is used more often than SubscribeOn.

I believe you're looking for SubscribeOn or ObserveOn, passing an IScheduler. There are several schedulers built-in under System.Concurrency; some of them use whatever thread is current, and others use specific threads.

This video has more info on the scheduler concept.

The Rx team also recently released a hands-on labs document which is the closest thing to a tutorial right now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!