I'm trying to kill a thread spawned this way:
Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or
(t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString =
"WaitSleepJoin, Suspended") Then
Else
t.Abort()
End If
The above runs when I close the application. The abort is hit and the main
form closes. Looking at the threads window, I can see the class spawned by
the thread is still active. It's suspend status is 1. It is also using
100% cpu. How can I debug why this thread will not die?
Thanks,
Brett 9 15245
If you want the background thread to die when the parent app closes just set
the threads background property to true before you start it.
"Brett" <no@spam.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl... I'm trying to kill a thread spawned this way: Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
The above runs when I close the application. The abort is hit and the
main form closes. Looking at the threads window, I can see the class spawned
by the thread is still active. It's suspend status is 1. It is also using 100% cpu. How can I debug why this thread will not die?
Thanks, Brett
If you want the background thread to die when the parent app closes just set
the threads background property to true before you start it.
"Brett" <no@spam.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl... I'm trying to kill a thread spawned this way: Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
The above runs when I close the application. The abort is hit and the
main form closes. Looking at the threads window, I can see the class spawned
by the thread is still active. It's suspend status is 1. It is also using 100% cpu. How can I debug why this thread will not die?
Thanks, Brett
Brett,
Does this thread help: http://groups-beta.google.com/group/...bbcf6fa6a59940
Hope this helps
Jay
"Brett" <no@spam.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl... I'm trying to kill a thread spawned this way: Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
The above runs when I close the application. The abort is hit and the main form closes. Looking at the threads window, I can see the class spawned by the thread is still active. It's suspend status is 1. It is also using 100% cpu. How can I debug why this thread will not die?
Thanks, Brett
No where in that post do I set the background property. If I try to do
this:
t.ThreadState.Background = True
I get this:
Constant cannot be the target of an assignment.
In summary, no - the the thread doesn't help.
Brett
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:eh**************@TK2MSFTNGP15.phx.gbl... Brett, Does this thread help:
http://groups-beta.google.com/group/...bbcf6fa6a59940
Hope this helps Jay
"Brett" <no@spam.com> wrote in message news:u4**************@tk2msftngp13.phx.gbl... I'm trying to kill a thread spawned this way: Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
The above runs when I close the application. The abort is hit and the main form closes. Looking at the threads window, I can see the class spawned by the thread is still active. It's suspend status is 1. It is also using 100% cpu. How can I debug why this thread will not die?
Thanks, Brett
Actually, I have the correct syntax and that seems to be working:
t.IsBackground = True
When the app is closing, I'm doing this:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or
(t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString =
"WaitSleepJoin, Suspended") Then
Else
t.Abort()
End If
That probably isn't needed anymore. The second thread is closing without
it, now that the background is set to true.
Thanks,
Brett
"Brett" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... No where in that post do I set the background property. If I try to do this: t.ThreadState.Background = True
I get this: Constant cannot be the target of an assignment.
In summary, no - the the thread doesn't help.
Brett
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:eh**************@TK2MSFTNGP15.phx.gbl... Brett, Does this thread help:
http://groups-beta.google.com/group/...bbcf6fa6a59940
Hope this helps Jay
"Brett" <no@spam.com> wrote in message news:u4**************@tk2msftngp13.phx.gbl... I'm trying to kill a thread spawned this way: Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
The above runs when I close the application. The abort is hit and the main form closes. Looking at the threads window, I can see the class spawned by the thread is still active. It's suspend status is 1. It is also using 100% cpu. How can I debug why this thread will not die?
Thanks, Brett
Brett,
Read the thread again: it states the IsBackground property, not the
background property. http://msdn.microsoft.com/library/de...roundtopic.asp
Hope this helps
Jay
"Brett" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... No where in that post do I set the background property. If I try to do this: t.ThreadState.Background = True
I get this: Constant cannot be the target of an assignment.
In summary, no - the the thread doesn't help.
Brett
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:eh**************@TK2MSFTNGP15.phx.gbl... Brett, Does this thread help:
http://groups-beta.google.com/group/...bbcf6fa6a59940
Hope this helps Jay
"Brett" <no@spam.com> wrote in message news:u4**************@tk2msftngp13.phx.gbl... I'm trying to kill a thread spawned this way: Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
The above runs when I close the application. The abort is hit and the main form closes. Looking at the threads window, I can see the class spawned by the thread is still active. It's suspend status is 1. It is also using 100% cpu. How can I debug why this thread will not die?
Thanks, Brett
Right, this will cause (the runtime I think) to kill the thread off when the
parent process dies.
The only thing you need to be careful of is what you are doing in that
thread. I am fairly certain that you have no control over what is being done
in that thread when it gets killed. If you are looping through a list for
instance your thread might die before the current loop is done.
"Brett" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl... Actually, I have the correct syntax and that seems to be working: t.IsBackground = True
When the app is closing, I'm doing this: If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
That probably isn't needed anymore. The second thread is closing without it, now that the background is set to true.
Thanks, Brett
"Brett" <no@spam.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... No where in that post do I set the background property. If I try to do this: t.ThreadState.Background = True
I get this: Constant cannot be the target of an assignment.
In summary, no - the the thread doesn't help.
Brett
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in
message news:eh**************@TK2MSFTNGP15.phx.gbl... Brett, Does this thread help:
http://groups-beta.google.com/group/...+thread+remain
+AbortRequested%3F+group:microsoft.public.dotnet.l anguages.vb&_done=%2Fgroup
s%3Fas_q%3DWhy+does+thread+remain+AbortRequested%3 F%26num%3D10%26scoring%3Dr
%26hl%3Den%26ie%3DUTF-8%26as_epq%3D%26as_oq%3D%26as_eq%3D%26as_ugroup%3D micr
osoft.public.dotnet.languages.vb%26as_usubject%3D% 26as_uauthors%3D%26lr%3D%2
6as_drrb%3Dq%26as_qdr%3D%26as_mind%3D1%26as_minm%3 D1%26as_miny%3D1981%26as_m
axd%3D28%26as_maxm%3D2%26as_maxy%3D2005%26safe%3Do ff%26&_doneTitle=Back+to+S
earch&&d#12bbcf6fa6a59940
Hope this helps Jay
"Brett" <no@spam.com> wrote in message news:u4**************@tk2msftngp13.phx.gbl... I'm trying to kill a thread spawned this way: Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
The above runs when I close the application. The abort is hit and the main form closes. Looking at the threads window, I can see the class spawned by the thread is still active. It's suspend status is 1. It
is also using 100% cpu. How can I debug why this thread will not die?
Thanks, Brett
It may not finish the entire loop but will finish the interaction it's in
correct?
Brett
"Ray Cassick" <rc******@nospam.enterprocity.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Right, this will cause (the runtime I think) to kill the thread off when the parent process dies.
The only thing you need to be careful of is what you are doing in that thread. I am fairly certain that you have no control over what is being done in that thread when it gets killed. If you are looping through a list for instance your thread might die before the current loop is done.
"Brett" <no@spam.com> wrote in message news:%2****************@TK2MSFTNGP15.phx.gbl... Actually, I have the correct syntax and that seems to be working: t.IsBackground = True
When the app is closing, I'm doing this: If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
That probably isn't needed anymore. The second thread is closing without it, now that the background is set to true.
Thanks, Brett
"Brett" <no@spam.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... > No where in that post do I set the background property. If I try to do > this: > t.ThreadState.Background = True > > I get this: > Constant cannot be the target of an assignment. > > In summary, no - the the thread doesn't help. > > Brett > > "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message > news:eh**************@TK2MSFTNGP15.phx.gbl... >> Brett, >> Does this thread help: >> >> http://groups-beta.google.com/group/...+thread+remain +AbortRequested%3F+group:microsoft.public.dotnet.l anguages.vb&_done=%2Fgroup s%3Fas_q%3DWhy+does+thread+remain+AbortRequested%3 F%26num%3D10%26scoring%3Dr %26hl%3Den%26ie%3DUTF-8%26as_epq%3D%26as_oq%3D%26as_eq%3D%26as_ugroup%3D micr osoft.public.dotnet.languages.vb%26as_usubject%3D% 26as_uauthors%3D%26lr%3D%2 6as_drrb%3Dq%26as_qdr%3D%26as_mind%3D1%26as_minm%3 D1%26as_miny%3D1981%26as_m axd%3D28%26as_maxm%3D2%26as_maxy%3D2005%26safe%3Do ff%26&_doneTitle=Back+to+S earch&&d#12bbcf6fa6a59940 >> >> >> Hope this helps >> Jay >> >> >> "Brett" <no@spam.com> wrote in message >> news:u4**************@tk2msftngp13.phx.gbl... >>> I'm trying to kill a thread spawned this way: >>> Form1 spawns Class1 via Thread.start() >>> >>> Here's my code to kill the thread: >>> >>> If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or >>> (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = >>> "WaitSleepJoin, Suspended") Then >>> Else >>> t.Abort() >>> End If >>> >>> The above runs when I close the application. The abort is hit and >>> the >>> main form closes. Looking at the threads window, I can see the class >>> spawned by the thread is still active. It's suspend status is 1. It is >>> also using 100% cpu. How can I debug why this thread will not die? >>> >>> >>> Thanks, >>> Brett >>> >> >> > >
I am not sure.
"Brett" <no@spam.com> wrote in message
news:eG**************@TK2MSFTNGP14.phx.gbl... It may not finish the entire loop but will finish the interaction it's in correct?
Brett
"Ray Cassick" <rc******@nospam.enterprocity.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... Right, this will cause (the runtime I think) to kill the thread off when the parent process dies.
The only thing you need to be careful of is what you are doing in that thread. I am fairly certain that you have no control over what is being done in that thread when it gets killed. If you are looping through a list
for instance your thread might die before the current loop is done.
"Brett" <no@spam.com> wrote in message news:%2****************@TK2MSFTNGP15.phx.gbl... Actually, I have the correct syntax and that seems to be working: t.IsBackground = True
When the app is closing, I'm doing this: If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = "WaitSleepJoin, Suspended") Then Else t.Abort() End If
That probably isn't needed anymore. The second thread is closing
without it, now that the background is set to true.
Thanks, Brett
"Brett" <no@spam.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... > No where in that post do I set the background property. If I try to
do > this: > t.ThreadState.Background = True > > I get this: > Constant cannot be the target of an assignment. > > In summary, no - the the thread doesn't help. > > Brett > > "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message > news:eh**************@TK2MSFTNGP15.phx.gbl... >> Brett, >> Does this thread help: >> >> http://groups-beta.google.com/group/...+thread+remain
+AbortRequested%3F+group:microsoft.public.dotnet.l anguages.vb&_done=%2Fgroup
s%3Fas_q%3DWhy+does+thread+remain+AbortRequested%3 F%26num%3D10%26scoring%3Dr
%26hl%3Den%26ie%3DUTF-8%26as_epq%3D%26as_oq%3D%26as_eq%3D%26as_ugroup%3D micr
osoft.public.dotnet.languages.vb%26as_usubject%3D% 26as_uauthors%3D%26lr%3D%2
6as_drrb%3Dq%26as_qdr%3D%26as_mind%3D1%26as_minm%3 D1%26as_miny%3D1981%26as_m
axd%3D28%26as_maxm%3D2%26as_maxy%3D2005%26safe%3Do ff%26&_doneTitle=Back+to+S earch&&d#12bbcf6fa6a59940 >> >> >> Hope this helps >> Jay >> >> >> "Brett" <no@spam.com> wrote in message >> news:u4**************@tk2msftngp13.phx.gbl... >>> I'm trying to kill a thread spawned this way: >>> Form1 spawns Class1 via Thread.start() >>> >>> Here's my code to kill the thread: >>> >>> If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin")
Or >>> (t.ThreadState.ToString = "Suspended") Or (t.ThreadState.ToString = >>> "WaitSleepJoin, Suspended") Then >>> Else >>> t.Abort() >>> End If >>> >>> The above runs when I close the application. The abort is hit and >>> the >>> main form closes. Looking at the threads window, I can see the
class >>> spawned by the thread is still active. It's suspend status is 1.
It is >>> also using 100% cpu. How can I debug why this thread will not
die? >>> >>> >>> Thanks, >>> Brett >>> >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jerry Sievers |
last post by:
Greetings Pythonists;
I have limited experience with threaded apps and plenty with old style
forked heavyweight multi-processing apps.
Using Python 2.3.3 on a Redhat 7.x machine.
Wondering...
|
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...
|
by: Brett |
last post by:
I'm trying to kill a thread spawned this way:
Form1 spawns Class1 via Thread.start()
Here's my code to kill the thread:
If (t.ThreadState.ToString = "SuspendedRequested, WaitSleepJoin") Or...
|
by: Hans |
last post by:
Hi all,
Is there a way that the program that created and started a thread also stops
it.
(My usage is a time-out).
E.g.
thread = threading.Thread(target=Loop.testLoop)
thread.start() ...
|
by: Thomas Dybdahl Ahle |
last post by:
Hi, I'm writing an application that connects to the internet.
Something like this:
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res...
|
by: Teja |
last post by:
Hi all,
Can any on help me out in killing a thread (i.e deleteing the reources
like, stack ,memory etc) which is started with
win32process.beginthreadex()???
Rite now, I am suspending the...
|
by: =?Utf-8?B?VGhlU2lsdmVySGFtbWVy?= |
last post by:
Because C# has no native SSH class, I am using SharpSSH. Sometimes, for
reasons I do not know, a Connect call will totally lock up the thread and
never return. I am sure it has something to do...
|
by: Mathieu Prevot |
last post by:
Hi,
I have a threading.Thread class with a "for i in range(1,50)" loop
within. When it runs and I do ^C, I have the error as many as
loops. I would like to catch this exception (and if possible...
|
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= |
last post by:
Hi misters,
Is it possible "kill" the thread of Backgroundworker ?
In my Dowork event, I have NOT While for do e.Cancel = true, only have a
call to external COM.
If I want cancel, calling...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |