Threads: how to kill

  • Thread starter Thread starter xzzy
  • Start date Start date
X

xzzy

foreach(Thread t in clsStaticVARS.threadHolder.Values)
{
If (t.Name == Name )
{
if (!t.IsAlive)
{
threadHolder.Remove(t.Name);
break;
}
}
}//end foreach



Where clsStaticVARS.threadHolder is defined as:

private static Hashtable _threadHolder = new Hashtable();
public static Hashtable threadHolder { get { return _threadHolder;} set
{ _threadHolder = value; } }


PROBLEM:
In the above foreach, how do I actually kill the thread?

Thank you,

John Bickmore
 
Threads kill themselves generally, when they finish executing, just as a
function is removed from the stack when it is finished executing. You can
call the Abort() method on the thread if necessary. Note that this will
raise a ThreadAbortException, which you will have to handle.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
I had no idea that threading was different with VB.Net. It sounds absurd on
the face of it, but I have never known you to say crazy things, Juan, so I
may have to look into that.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
You were right in the first part, Juan. Even though I have been known as a
cunning linguist, I completely missed your play on words! Maybe I need to
take a day off...

I have never seen that particular combination of symbols. What does it mean,
BTW?

P.S. Thanks for saving me the trouble of checking out your joke!
--

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
Muchas gracias, amigo!

--

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top