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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:58:34+00:00 2026-05-11T00:58:34+00:00

I’ve seen a number of examples that have a thread procedure that looks like

  • 0

I’ve seen a number of examples that have a thread procedure that looks like this.

    private void ThreadProc()     {         while (serviceStarted)         {             // do some work              Thread.Sleep(new TimeSpan(0, 0, 5));         }          Thread.CurrentThread.Abort();     } 

Is the Abort() really necessary at the end?

There are number of arguments against calling Abort()

  1. Once the procedure exited – it is expected it has already cleaned up after itself.
  2. Calling Abort() throws an exception, which is generally more resource intensive than just exiting a procedure.

I’d like to read an explanation for why this is or isn’t a good practice.

  • 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-11T00:58:35+00:00Added an answer on May 11, 2026 at 12:58 am

    Calling Thread.Abort() does raise an exception, and if you’re writing code that will be re-used (or part of a base library) it’s difficult for other developers to handle ThreadAbortExcpetions.

    It’s explained in this article about Reliability Best Practices.

    I’ve always heard that calling Thread.Join() is a better way to do it, if you can wait until the thread is completed processing.

    I don’t know if anyone thinks it’s a good practice. It can cause deadlocks (because unmanaged resources aren’t properly cleaned up when you throw an exception)

    Here’s another article about it, and other methods to deal with the issue.

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

Sidebar

Ask A Question

Stats

  • Questions 51k
  • Answers 51k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I'd do it this way: <style type='text/css'> div.custom { background:url(/images/input-bkg-w173.gif)… May 11, 2026 at 6:33 am
  • added an answer Here's some code that works for me. using System; using… May 11, 2026 at 6:33 am
  • added an answer Instead of using a datatable you could use the SQLDataSource… May 11, 2026 at 6:32 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

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.