473,767 Members | 7,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Threads: how to kill

foreach(Thread t in clsStaticVARS.t hreadHolder.Val ues)
{
If (t.Name == Name )
{
if (!t.IsAlive)
{
threadHolder.Re move(t.Name);
break;
}
}
}//end foreach

Where clsStaticVARS.t hreadHolder 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
Nov 19 '05 #1
7 1463
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 ThreadAbortExce ption, which you will have to handle.

--
HTH,

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

"xzzy" <mr********@com cast.net> wrote in message
news:yq******** *************** *******@comcast .com...
foreach(Thread t in clsStaticVARS.t hreadHolder.Val ues)
{
If (t.Name == Name )
{
if (!t.IsAlive)
{
threadHolder.Re move(t.Name);
break;
}
}
}//end foreach

Where clsStaticVARS.t hreadHolder 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

Nov 19 '05 #2
re:
Threads kill themselves generally
Not the "VB.NET vs. C#" threads...

<g, d & r>

Juan
====
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OH******** *****@TK2MSFTNG P10.phx.gbl...
Threads kill themselves generally

Nov 19 '05 #3
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.

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
re:
Threads kill themselves generally


Not the "VB.NET vs. C#" threads...

<g, d & r>

Juan
====
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OH******** *****@TK2MSFTNG P10.phx.gbl...
Threads kill themselves generally


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

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u5******** ******@TK2MSFTN GP09.phx.gbl...
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 "Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
re:
Threads kill themselves generally


Not the "VB.NET vs. C#" threads...

<g, d & r>

Juan
====
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OH******** *****@TK2MSFTNG P10.phx.gbl...
Threads kill themselves generally

Nov 19 '05 #5
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.

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:uX******** ******@TK2MSFTN GP09.phx.gbl...
Either I needed to insert a smilie instead of <g, d & r>
or you are the best stone-faced legpuller I've ever seen.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u5******** ******@TK2MSFTN GP09.phx.gbl...
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

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
re:
Threads kill themselves generally

Not the "VB.NET vs. C#" threads...

<g, d & r>

Juan
====
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OH******** *****@TK2MSFTNG P10.phx.gbl...

Threads kill themselves generally


Nov 19 '05 #6
re:
I have been known as a cunning linguist
I thought that :
Threads kill themselves generally
Not the "VB.NET vs. C#" threads...
was a cunning lingual expression... ;-)

re: I have never seen that particular combination of symbols.
<g, d & r> = <grin, duck and run>

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:eH******** ********@TK2MSF TNGP15.phx.gbl. .. 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. "Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:uX******** ******@TK2MSFTN GP09.phx.gbl...
Either I needed to insert a smilie instead of <g, d & r>
or you are the best stone-faced legpuller I've ever seen.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u5******** ******@TK2MSFTN GP09.phx.gbl...
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

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
re:
> Threads kill themselves generally

Not the "VB.NET vs. C#" threads...

<g, d & r>

Juan
====
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OH******** *****@TK2MSFTNG P10.phx.gbl...

> Threads kill themselves generally



Nov 19 '05 #7
Muchas gracias, amigo!

--

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

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
re:
I have been known as a cunning linguist


I thought that :
Threads kill themselves generally
Not the "VB.NET vs. C#" threads...


was a cunning lingual expression... ;-)

re:
I have never seen that particular combination of symbols.


<g, d & r> = <grin, duck and run>

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:eH******** ********@TK2MSF TNGP15.phx.gbl. ..
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.

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:uX******** ******@TK2MSFTN GP09.phx.gbl...
Either I needed to insert a smilie instead of <g, d & r>
or you are the best stone-faced legpuller I've ever seen.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u5******** ******@TK2MSFTN GP09.phx.gbl...
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

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
> re:
>> Threads kill themselves generally
>
> Not the "VB.NET vs. C#" threads...
>
> <g, d & r>
>
> Juan
> ====
> "Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
> news:OH******** *****@TK2MSFTNG P10.phx.gbl...
>
>> Threads kill themselves generally



Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8982
by: John | last post by:
If my main UI thread starts a worker thread, who starts its own worker thread. So if i just close my app, in the closing event i can kill the thread the UI thread starts. but how can i kill the worker thread that the UI thread's worker thread started?
6
9174
by: news.microsoft.com | last post by:
I have a very multi-threaded Windows Forms application. There are many BeginInvoke calls, as well as Thread/ThreadStarts. My issue is that when I quit my application there are often threads hanging around that prevent the process from dying. I've gone through my code line by line looking for orphaned threads, but I'm unable to figure out where they are being created. Is there any way to kill all threads spawned by a process without...
6
15970
by: Bob Day | last post by:
VS 2003, vb.net ... Is there an easy way to kill from the main form all threads running ? Is there a thread collection to iterate through to kill each one? I know each thread's name, so could I kill it via the name? The trick is I am not in any of these threads I am trying to kill. None of these threads on there own ever die (they are always running in the background). I think I could set up an array when the threads are started,...
2
4570
by: jgbid | last post by:
Hi, I'm trying to build an IP Scanner inc c# for a specific port (80) and for specific IP Ranges. For example 24.36.148.1 to 24.36.148.255 My first step was to use TcpClient, but there are nothing to control Timeout Connection... and I wasn't interested to wait 25-30sec for each ip. After some search, it's look like Socket was the solution with
0
9575
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9407
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10015
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9842
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7384
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.