473,508 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Thread.Abort Question?

Hello,

I have a subroutine, sub1 that creates 2 new Threads.
Each Thread then runs a subroutine of their own. Sub1 is
on a timer and when called will create 2 new threads each
time. I observed the Windows Task Manager Performance Tab
for the count of threads, handles, processes. I let Sub1
run several times and create several threads. I thought
of terminating each thread with Thread.Abort. Task
Manager does show an increase in threads when Sub1 creates
the new threads. But when the subroutines in the new
threads have completed, the thread count goes down in Task
Manager whether I use Thread.Abort or not. I have not yet
tested sub1 for a several day interval.

Could someone advise me if I need to terminate these
threads if I will be creating new ones on a timed
schedule? Is Thread.Abort the correct way to terminate
these threads?

Thanks
Nov 21 '05 #1
1 1246
In article <20****************************@phx.gbl>, Steve wrote:
Hello,

I have a subroutine, sub1 that creates 2 new Threads.
Each Thread then runs a subroutine of their own. Sub1 is
on a timer and when called will create 2 new threads each
time. I observed the Windows Task Manager Performance Tab
for the count of threads, handles, processes. I let Sub1
run several times and create several threads. I thought
of terminating each thread with Thread.Abort. Task
Manager does show an increase in threads when Sub1 creates
the new threads. But when the subroutines in the new
threads have completed, the thread count goes down in Task
Manager whether I use Thread.Abort or not. I have not yet
tested sub1 for a several day interval.

Could someone advise me if I need to terminate these
threads if I will be creating new ones on a timed
schedule? Is Thread.Abort the correct way to terminate
these threads?

Thanks


A thread ends when it's method exits. So, you don't need to call
Thread.Abort, unless you want to cause an early termination of your
thread.

--
Tom Shelton [MVP]
Nov 21 '05 #2

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

Similar topics

2
2336
by: cottonviking | last post by:
Greetings, all! I've been pondering the pitfalls of aborting a secondary thread in a service app I'm writing (VB, fx v1.1). Everything I've read so far pretty much dissuades one from aborting one...
14
5321
by: Daisy | last post by:
From this page: http://www.c-sharpcorner.com/2/mt_beginner1.asp Thread class's Abort method is called to kill a thread permanently. Make sure you call IsAlive before Abort. if (...
20
2990
by: Doug Thews | last post by:
I ran into an interesting re-pain delay after calling the Abort() method on a thread, but it only happens the very first time I call it. Every time afterward, there is no delay. I've got a...
1
4454
by: benmorganpowell | last post by:
I have a small windows service which connects to a POP3 server at defined intervals, scans the available messages, extracts the required information and inserts the data into a SQL database. I am...
1
1215
by: Robin Tucker | last post by:
Hi there, I have a "worker thread", which can perform one of many tasks, including fetching and sending data blobs to a database, load files etc. Now, a progress dialog is displayed while the...
3
5937
by: jmd.msdn | last post by:
Hello. I want to abort a thread whose thread function contains something like : void threadfunc () { while ( 1 ) { ... some code udpClient.Receive(...); // instance to read network data...
6
7427
by: foolmelon | last post by:
If a childThread is in the middle of a catch block and handling an exception caught, the main thread calls childThread.Abort(). At that time a ThreadAbortException is thrown in the childThread. ...
5
5066
by: andrew | last post by:
Hi, I have the following issue with the Thread.Abort(): The main thread creates a worker thread which waits on a process termination. void ThreadProc() { Process proc =...
6
2926
by: mehdi | last post by:
Hi folks, You know, the Thread class has got a method named Abort which according to the msdn: "Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of...
7
1237
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my Windows application, I'm using thread, and I've 2 questions: 1. I read that it's not recommended to use Thread.Abort(), so what is the best way to close the thread, in case the user...
0
7336
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
7401
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...
0
7504
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
5640
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,...
1
5059
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...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.