Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8494537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:19:33+00:00 2026-06-10T23:19:33+00:00

With the Rx Subject , is it thread-safe to call OnNext() from multiple threads?

  • 0

With the Rx Subject, is it thread-safe to call OnNext() from multiple threads?

So the sequence can be generated from multiple sources.

Will merge do the same thing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:19:34+00:00Added an answer on June 10, 2026 at 11:19 pm

    The Rx contract requires that notifications be sequential, and is a logical necessity for several operators. That said, you can use the available Synchronize methods to get this behaviour.

    var subject = new Subject<int>();
    var syncedSubject = Subject.Synchronize(subject);            
    

    You can now make concurrent calls to syncedSubject.
    For an observer which must be synchronized, you can also use:

    var observer = Observer.Create<Unit>(...);
    var syncedObserver = Observer.Synchronize(observer);
    

    Test:

    Func<int, Action> onNext = i => () => syncedSubject.OnNext(i);
    Parallel.Invoke
    (
        onNext(1),
        onNext(2),
        onNext(3),
        onNext(4)
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code using Rx, called from multiple threads that does: subject.OnNext(value); //
As the subject says, I'm posting events from non-GUI thread (some GStreamer thread, to
So, as I'm sure you can tell from my rather long subject what I'm
Given the following code. EventLoopScheduler scheduler = new EventLoopScheduler(ts => new Thread(ts)); BehaviorSubject<int> subject
I was reading different threads on the subject which suggested the Swing Timer class
The subject says it all. Trying to see if I can't change that loading
consider the following document structures: Thread: - doc_type 1 - _id - subject (string)
Upon initialization, GDI+ (non .NET) creates a background thread, which can optionally be suppressed
They brush the subject in this thread, but it does not really answer much:
What is the standard way to get an exit code from a boost::thread ?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.