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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:51:02+00:00 2026-05-16T10:51:02+00:00

I have a local thread that is started on button-click event from the main

  • 0

I have a local thread that is started on button-click event from the main thread. Its name is RegistrationThread. I want to stop this thread on another stop button-click event.

How do I stop RegistrationThread that is a local thread and I cannot access this thread by its name?

If I get the RegistrationThread, then is it possible to suspend it? How to do this?

  • 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-16T10:51:02+00:00Added an answer on May 16, 2026 at 10:51 am

    Aborting a thread is usually a measure of last resort. The reason is because it can cause a lot of unintended side-effects. The best practice is to allow the worker thread to end gracefully at predetermined safe points. This can be done correctly in many different ways. One of the simplest is to set a flag indicating to the worker thread that it should begin shutting down.

    public class YourForm : Form
    {
      private volatile bool m_Stop = false;
    
      private void StartButton_Click(object sender, EventArgs e)
      {
        var thread = new Thread(
          () =>
          {
            while (...)
            {
              // Periodically poll the m_Stop flag.
              if (m_Stop)
              {
                break;
              }
            }
          });
        thread.Start();
      }
    
      private void StopButton_Click(object sender, EventArgs e)
      {
        m_Stop = true;
      }
    }
    

    If you really want to abort a thread then you could always save away a reference to the Thread and then call Abort on it from your stop button click event.

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

Sidebar

Related Questions

I have a Dllmain that allocates Thread local storage when a thread attaches to
I have some JNI code in a thread that calls from Java to C.
I have a local version of LinkedMDB that is in N-Triples format and want
I have a local repository. I created the whole application, but now I want
I have a com server that is started in the following way: extern C
I have a client-server app and i observed that (in a local environment i.e.
I have a multi-threaded .Net app in which thread-local storage is used to hold
I have an Activity (RecipiesActivity) that is opened by clicking on the Next button
I have local data in a grid. How can I get all of the
I have local server for my site (i made it with XAMPP). How can

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.