Threading.Tasks analog in Rx extensions in .NET 3.5?

Is it possible to use Reactive Extensions (Rx) to create applications in .NET 3.5 that perform parallelization or are limited in some way? I downloaded Rx from here http://www.microsoft.com/download/en/confirmation.aspx?id=26649 and after creating a simple project with referenced reactive assemblies, I could not find classes that correspond to tasks in .NET. 4.0. I am trying to find classes for Tasks, but alas, I cannot find them. Am I doing something wrong?

+3
c # system.reactive
Jul 31 '11 at 19:32
source share
6 answers

Perhaps samples from the rx wiki may help you.

The simplest background task would be the following:

var o = Observable.Start ( () => { Console.WriteLine("Calculating..."); Thread.Sleep(3000); Console.WriteLine("Done."); } ); o.First(); // subscribe and wait for completion of background operation 

But you can also see forkjoin examples.

+1
Jul 31 '11 at 19:51
source share
— -

As mentioned above, you can find backported System.Threading.dll in an old Rx installation.

For easier integration, I made nuget from it (called TaskParallelLibrary ).

You can get it from http://nuget.org/packages/TaskParallelLibrary .

+5
Apr 27 2018-12-12T00
source share

As far as I know, the latest version of Reactive Extensions includes a " stand-alone stand-alone DLL named System.Threading.dll " Active Extensions (Rx) v1.0.2856.0 released on 11/21/2011 (in Rx_Net35.msi).

(I really got it as Rx_Net35.v1.0.2856.0.msi, downloaded in May, I think from CodePlex, I can no longer find it ... it was installed as C:\Program Files (x86)\Microsoft Cloud Programmability\Reactive Extensions\v1.0.2856.0\Net35\System.Threading.dll on my 64-bit system.)

+4
Oct 12 '11 at 21:45
source share

System.Threading, a build for TPL has been included in Rx releases, but no longer exists.

You may find it in older versions.

However, IObservable<T> similar to Task<T> with a key difference: Task<T> can have only 1 result, IObservable<T> is a stream of 0 or more results.

+3
Jul 31 '11 at 20:02
source share

Rx in .NET 3.5 cannot use Tasks, it uses the .NET 3.5 thread pool, however, as Scott says, IObservable works like a Task when IObservable is one element long.

+1
Jul 31 '11 at 20:33
source share

Please correct me if I am wrong somewhere.

Observers and observers are mainly associated with the task - Observe (expect data) and sign (so that observers receive the data that was clicked).

Observable provides two statements to improve the performance of the above two tasks.

one). Observable.ObserveOn - asynchronously notify the observer according to the specified schedule. The task can be performed better using Schedular, where it takes an argument either

  • Scheduler.CurrentThread (Pay attention to the current current thread)
  • Scheduler.NewThread (watch every time in a new thread)
  • Scheduler.TaskPool (note the TaskPool mechanism, I think you might be interested.)
  • Scheduler.ThreadPool (note the ThreadPool mechanism)

the same for the second ....

2). Observable.SubscribeOn - subscribe asynchronously - unsubscribe observers on specific schedulers.

It also has the same options as above to schedule a subscription.

In this way, Rx provides built-in capabilities to plan your process for quick results.

+1
Aug 02 2018-11-11T00:
source share



All Articles