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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:39:36+00:00 2026-05-11T06:39:36+00:00

TL;DR version: I have two threads. One of them might need to Interrupt() the

  • 0

TL;DR version: I have two threads. One of them might need to Interrupt() the other, but only if the other thread is in th middle of processing data that is related to the object that is affected by the first thread. How can I only Interrupt() the second thread based on certain conditions.

I have been working on a program that spins up two threads for processing socket data and updating the GUI with the information. The two threads (topologyThread and dataThread) handle two different aspects of my application, namely topology change notifications for our wireless sensor network, and data information for receiving and processing data from the wireless sensor network.

When data is coming into the dataThread, it’s possible that the network member that the data packet represents has already been removed by the topologyThread and as such should not be processed. So, I was thinking that using the Thread.Interrupt() method would allow me to instantly notify the dataThread of changes to the topology and prevent some of the problems we have seen with trying to update the GUI with data for a network member that is no longer connected. My question is this: How can I tell if the dataThread needs to be interrupted? I don’t want it to throw an exception while it’s processing data for a network member that is still connected, but I want it to be interrupted if it’s in the middle of processing data for a network member that is then disconnected.

Scenario 1:

  • Data comes in on dataThread.
  • dataThread makes sure network member is still part of the network.
  • dataThread processes data to the end and updates GUI

Scenario 2:

  • Data comes in on dataThread.
  • dataThread makes sure network member is still part of the network.
  • Network member has been disconnected so no processing takes place.

Scenario 3:

  • Data comes in on dataThread.
  • dataThread makes sure network member is still part of the network.
  • dataThread begins processing data
  • topologyThread receives notice that the network member is disconnected and removes it from topology.
  • dataThread tries to update GUI for a network member that is no longer connected.

It’s scenario 3 that I am trying to code for. In our testing, this scenario is where the tree view in the sidebar freezes up and the app has to be killed. But I only need to interrupt the dataThread if the object that is affected by the topologyThread is the one that the dataThread is currently acting on.

Thanks for reading. 🙂

  • 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. 2026-05-11T06:39:36+00:00Added an answer on May 11, 2026 at 6:39 am

    dataThread tries to update GUI for a network member that is no longer connected.

    What if you have topologyThread set a flag when the network member is no longer connected, and have dataThread check that flag before attempting to update the GUI?

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

Sidebar

Related Questions

Currently I have two MediaWikis, one a slightly older version than the other. I
We have two branches: 1. HEAD - the latest version (AKA Trunc) 2. PROD
Here is a simplified version of my database model. I have two tables: Image,
We have two versions of a managed C++ assembly, one for x86 and one
I have a need to reference two different versions of the Sharepoint API dll.
These two may look like they have no correlation but bear with me! In
I have two versions of the same proof-of-concept site: The unsecure version: http://www.tlsadmin.com/tlsadmin/PortalHome.aspx and
I have two alternative using timer or using sleep, I need to call a
I have two versions of rails (2.1.0 and 2.2.2) installed in my computer. When
I'm looking to have two versions of BOOST compiled into a project at the

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.