473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Terminating a thread

Hi

I am using the Suspend method to terminate a thread but it seems that after
calling that method the IsLive property is still set to True

Is there another way to terminate a thread from the program?

Thank you in advance
Shmuel Shulman
Nov 21 '05 #1
4 1284
Try:

Thread.Abort()
Nov 21 '05 #2
"S Shulman" <sm*******@hotmail.com> schrieb:
I am using the Suspend method to terminate a thread but it seems that
after calling that method the IsLive property is still set to True

Is there another way to terminate a thread from the program?


How To Stop a Thread in .NET (and Why 'Thread.Abort' is Evil)
<URL:http://www.interact-sw.co.uk/iangblog/2004/11/12/cancellation>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
I'm a little concerned about the title of and some of the language used in
the article you highlighted.

While I agree totally with the gist of the article I see the the phrase
"'Thread.Abort' is Evil" as being inappropriate.

Yes, it can be dangerous if is not used properly or used without
understanding what it actually does, but, as the author points out, it is
actually quite appropriate and, indeed, desirable to use it under certain
circumstances.

Now, there a number of readers who will know that you know what you are
talking about and assume that you agree that "'Thread.Abort' is Evil" and
will be guided by that. Whether you do endorse it or not is largely
irrelevant. It's a matter of readers perceptions. As we have all seen in the
past, such perceptions can easily lead to subsequent posts that contain
mis-information and misunderstandings, and, I think you will agree, such
posts are not helpful and can have undesirable consequences.

I wonder if it might be prudent that, when one posts a link to an article
that could be considered 'controversial', that one gives a comment as to the
fact that it might not be the only answer and/or whether or not the article
is endorsed by the poster.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uo****************@tk2msftngp13.phx.gbl...
"S Shulman" <sm*******@hotmail.com> schrieb:
I am using the Suspend method to terminate a thread but it seems that
after calling that method the IsLive property is still set to True

Is there another way to terminate a thread from the program?


How To Stop a Thread in .NET (and Why 'Thread.Abort' is Evil)
<URL:http://www.interact-sw.co.uk/iangblog/2004/11/12/cancellation>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
Bravo and well said!!
"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I'm a little concerned about the title of and some of the language used in
the article you highlighted.

While I agree totally with the gist of the article I see the the phrase
"'Thread.Abort' is Evil" as being inappropriate.

Yes, it can be dangerous if is not used properly or used without
understanding what it actually does, but, as the author points out, it is
actually quite appropriate and, indeed, desirable to use it under certain
circumstances.

Now, there a number of readers who will know that you know what you are
talking about and assume that you agree that "'Thread.Abort' is Evil" and
will be guided by that. Whether you do endorse it or not is largely
irrelevant. It's a matter of readers perceptions. As we have all seen in
the past, such perceptions can easily lead to subsequent posts that
contain mis-information and misunderstandings, and, I think you will
agree, such posts are not helpful and can have undesirable consequences.

I wonder if it might be prudent that, when one posts a link to an article
that could be considered 'controversial', that one gives a comment as to
the fact that it might not be the only answer and/or whether or not the
article is endorsed by the poster.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uo****************@tk2msftngp13.phx.gbl...
"S Shulman" <sm*******@hotmail.com> schrieb:
I am using the Suspend method to terminate a thread but it seems that
after calling that method the IsLive property is still set to True

Is there another way to terminate a thread from the program?


How To Stop a Thread in .NET (and Why 'Thread.Abort' is Evil)
<URL:http://www.interact-sw.co.uk/iangblog/2004/11/12/cancellation>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Nov 21 '05 #5

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

Similar topics

2
by: Byron | last post by:
I'm new to C# and threading, so hopefully this is a simple newbie question. I have a form that is supposed to listen for network traffic on a given port and decode and display any interesting...
23
by: Adam Clauss | last post by:
I have a C# Windows Service running as the NetworkService account because it needs to access a network share. As part of the service's initialization, I want the service to terminate, if an...
6
by: Tomaz Koritnik | last post by:
I have a class that runs one of it's method in another thread. I use Thread object to do this and inside ThreadMethod I have an infinite loop: While (true) { // do something Thread.Sleep(100);...
2
by: Byron | last post by:
I'm new to C# and threading, so hopefully this is a simple newbie question. I have a form that is supposed to listen for network traffic on a given port and decode and display any interesting...
2
by: PhotoLover | last post by:
I have gotten 3 messages saying, "Terminating thread due to stack overflow problems. A V&D, possibly recently installed has consumed too much stack space. Increase the settings of MinSP's in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.