473,775 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Killing all threads.

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, and then go
back to that array and iterate through it somehow, but I was looking for
something simpler.

In debug mode, closing the main form & exit.applicatio n does not seem to
kill running threads.

Somthing like:

Kill.AllThreads

would be perfect.

thansk!

Bob Day
Nov 20 '05 #1
6 15970
"Bob Day" <Bo****@TouchTa lk.net> schrieb
Somthing like:

Kill.AllThreads

would be perfect.

System.Diagnost ics.Process.Get CurrentProcess. Threads

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
* "Bob Day" <Bo****@TouchTa lk.net> scripsit:
Is there an easy way to kill from the main form all threads running ? Is [...]
Somthing like:

Kill.AllThreads

would be perfect.


Very brutal method (/not/ recommended):

\\\
Dim t As System.Threadin g.Thread
For Each t In System.Diagnost ics.Process.Get CurrentProcess( ).Threads
t.Abort()
Next t
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Cor
Hi Bob,

In addition to Herfried and Armin,

In the documentation is written , that threads can be aborted but not direct
killed.

So you have to wait a while to see it.

I hope this helps,

Cor
Nov 20 '05 #4
"Cor" <no*@non.com> schrieb
In the documentation is written , that threads can be aborted but not
direct killed.

So you have to wait a while to see it.


Me.Shoot(cow)
Thread.Sleep(50 00)
If Not Me.Look(Directi on.Everywhere, GetType(Cow)) Then
Me.Cry "booooooohhoooo hoooo"
End If
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
Cor
Hi Armin,

I love to answer this
Me.Shoot(cow)
Thread.Sleep(50 00)
If Not Me.Look(Directi on.Everywhere, GetType(Cow)) Then
Me.Cry "booooooohhoooo hoooo"
End If


Sorry I do not understand you,

:-)))

Cor
Nov 20 '05 #6
Thanks!
bob day
"Bob Day" <Bo****@TouchTa lk.net> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
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, and then go
back to that array and iterate through it somehow, but I was looking for
something simpler.

In debug mode, closing the main form & exit.applicatio n does not seem to
kill running threads.

Somthing like:

Kill.AllThreads

would be perfect.

thansk!

Bob Day

Nov 20 '05 #7

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

Similar topics

0
1106
by: Don Garrett | last post by:
I've been developing with external multi-threaded libraries recently. I find it difficult to use the Python prompt to experiment with these libraries because there isn't any way to just shutdown all threads and try things again. If I try to exit the prompt with background threads running, then Python hangs and I have to kill the process to exit. Ctrl C won't do it. Is there some way to brutally kill all background threads? Just for
1
1301
by: Amendra | last post by:
hi, I have a Parent child design of a multi threaded application in C#. My issue is I want the parent class to be able abort or stop the child threads. I tried abort from the parent, then the child goes to ThreadAbort Requested state, and not abort state. But when I call the abort method from the child Thread itself, it throws ThreadAbortException and aborts. Why is it, that this does not work the same way when being aborted by the...
10
9887
by: Jacek Pop³awski | last post by:
Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for example: os.system("someapplication.exe") and kill it, if it waits longer than let's say 100 seconds
4
4270
by: muscha | last post by:
Hi, I spawns a number of background threads while creating a windows forms application. I noticed that when I quit the application or calling Application.Exit, it hasn't really stop. Is there a quick way to say "terminate all threads and quit"? thanks, /m
5
3983
by: | last post by:
Hi I have thread that recives event notifications from a server. the thread is created as a managed thread. But when using Thread Abort the thread doesn't terminate. the thread is in an waitable state using WSAWaitForMultipleEvents. How can I kill this thread, i don't mind brute force. /Steffo
2
1323
by: mmitchell | last post by:
I have a service that executes a method in a dll. This method spawns several threads. When I stop the service I notice the process doesn't stop right away. I assume the threads that some time to finish. What can I don the the OnStop method to insure all threads are completed before stopping the service? Thanks for any help.
8
12410
by: Rob | last post by:
Hello, I've got an issue where a process in a third party application has a dll which while exiting sort of freezes and runs away with processor cycles. i've written a block of code so that I can drill down into the process, and get the offending Thread's ID (since the only ones that will have the issue have higher User processor Time). But, I can't figure out how to have my .Net app 'kill' or 'suspend' a Thread
3
1392
by: michdoh | last post by:
Hi All I'm looking for some help on creating a basic multi threaded application. i'n new to threads in this environment so for test purposes I've produced a very basic program. (which doesn't work) Calling the 2 methods directly has the desired effect however when I try to impelment them as threads nothing happens.
41
2114
by: Carl J. Van Arsdall | last post by:
Hey everyone, I have a question about python threads. Before anyone goes further, this is not a debate about threads vs. processes, just a question. With that, are python threads reliable? Or rather, are they safe? I've had some strange errors in the past, I use threading.lock for my critical sections, but I wonder if that is really good enough. Does anyone have any conclusive evidence that python threads/locks are safe or unsafe?
6
1908
by: Roger Heathcote | last post by:
sjdevnull@yahoo.com wrote: <snip> Fair point, but for sub processes that need to be in close contact with the original app, or very small functions that you'd like 100s or 1000s of it seems like a kludge having to spawn whole new processes build in socket communications and kill via explicit OS calls. I can't see that approach scaling particularly well but I guess there's no choice. Does anyone think it likely that the threading...
0
9454
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
10106
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...
1
10046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8939
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
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
6717
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5358
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...
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.