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? I thought once the procedure exited that it cleaned up after itself. Additionally doesn't calling Abort() throw 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.