Threads: how to kill

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
 
K

Kevin Spencer

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.
 
K

Kevin Spencer

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.
 
J

Juan T. Llibre

Either I needed to insert a smilie instead of <g, d & r>
or you are the best stone-faced legpuller I've ever seen.

;-)
 
K

Kevin Spencer

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.
 
K

Kevin Spencer

Muchas gracias, amigo!

--

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
Joined
Dec 19, 2008
Messages
1
Reaction score
0
Seriously

Guys,

Serious question, the comments on language are confusing me. What is the proper way to kill a thread in ASP.Net 2.0, VB.Net?

Thanks
 

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

Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,404
Latest member
PerryRutt

Latest Threads

Top