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 6946697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:35:54+00:00 2026-05-27T13:35:54+00:00

In one thread (thread2) I have changed a value e.g. CheckSuccess = false; Now

  • 0

In one thread (thread2) I have changed a value e.g.

CheckSuccess = false;

Now the main thread (thread1 – GUI / Form) does not pickup the change, how would it be possible to “propogate” the changes around all threads?

I was under the impression that threads should manipulate the data, not work on seperate instances (unless told to do so)

  • 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-05-27T13:35:55+00:00Added an answer on May 27, 2026 at 1:35 pm

    It seems like a Race Condition. To avoid this you should synchronize an access to the shared variables.

    • If CheckSuccess is a field – try out marking it by volatile keyword.
    • If CheckSuccess is a property (which will be translated to a method call) you can use lock() statement:

      private static readonly object stateLock = new object();
      lock (stateLock)
      {
          // access a shared variable here
          CheckSuccess  = false;
      }
      
    • If CheckSuccess is a property of UI control and you want changing it from a worker thread – you should use special techniques to push changes from a worker to the UI thread, it depends on which framework you are using WinForms of WPF.

      • WinForms – How to update GUI from another thread in C#?
      • WPF – Update WPF controls at run time

    PS:
    Also if you have multiple threads reading a value and few threads writing (basically reads more often than writing) you may find useful ReaderWriterLock

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one thread that writes results into a Queue. In another thread (GUI),
I have an application that has two threads. The first one (the main thread)
I have one thread that is receiving data over a socket like this: while
I have two threads, one thread processes a queue and the other thread adds
I have 2 threads and global Queue, one thread (t1) push the data and
Let's say that I have the following code that's run in one thread of
I have class A and classes B and C. class B runs one thread
I have one std::list<> container and these threads: One writer thread which adds elements
I am writing code in VS2005 using its STL. I have one UI thread
I have two threads in an Android application, one is the view thread, and

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.