title: Avoiding overlapping OnNext calls in Rx when using SubscribeOn(Scheduler.TaskPool)
body: <p>I have some code using Rx, called from multiple threads that does:</p>
  
  <pre><code>subject.OnNext(value); // where subject is Subject&lt;T&gt;
  </code></pre>
  
  <p>I want the values to be processed in the background, so my subscription is</p>
  
  <pre><code>subscription = subject.ObserveOn(Scheduler.TaskPool).Subscribe(value =&gt;
  {
      // use value
  });
  </code></pre>
  
  <p>I don't really care which threads handle values coming out of the Observable, as long as the work is put into the TaskPool and doesn't block the current thread. However, my use of 'value' inside my OnNext delegate is not thread safe. At the moment, if a lot of values are going through the Observable I'm getting overlapping calls to my OnNext handler. </p>
  
  <p>I could just add a lock to my OnNext delegate, but that doesn't feel like the Rx way of doing things. What's the best way to make sure I only have one call to my OnNext handler at a time, when I have multiple threads calling <code>subject.OnNext(value);</code>?</p>