Kill thread
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 thread. But any pointers as to how to delete the thread permanently? Its pretty urgent... Please... Teja.P -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill thread
Hi! If you have the PID of the process (example: 1234), use this command-line : TASKKILL /F /PID 1234 -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill thread
On Apr 9, 3:01 pm, Michel Claveau <[EMAIL PROTECTED]> wrote: > Hi! > > If you have the PID of the process (example: 1234), use this > command-line : >TASKKILL/F /PID 1234 > > -- > @-salutations > > Michel Claveau Hi Michel, Thnks for the replyBut TASKKILL kills the process entirely..Not the thread. I want only the thread to be killed. Actually I am starting the thread in main thread. I jus want to kill the child thread and keep the main thread running. With TASKKILL, the main thread is also exited...I dont want it to happen.. Wht do i do?? Awaiting for a reply Teja.P -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill thread
On Apr 9, 5:14 am, "Teja" <[EMAIL PROTECTED]> wrote: > 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 thread. But any pointers as to how to > delete the thread permanently? > > Its pretty urgent... Please... > > Teja.P Well, the answer with Python threads is that you don't kill them - you ask them to go away. But since you are using something in the pywin32 package, that rule might not apply. Perhaps you would have better luck asking on the python-win32 list: http://mail.python.org/mailman/listinfo/python-win32 Christian http://www.dowski.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill thread
On Apr 9, 6:18 pm, "Christian" <[EMAIL PROTECTED]> wrote: > On Apr 9, 5:14 am, "Teja" <[EMAIL PROTECTED]> wrote: > > > 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 thread. But any pointers as to how to > > delete the thread permanently? > > > Its pretty urgent... Please... > > > Teja.P > > Well, the answer with Python threads is that you don't kill them - you > ask them to go away. But since you are using something in the pywin32 > package, that rule might not apply. Perhaps you would have better > luck asking on the python-win32 > list:http://mail.python.org/mailman/listinfo/python-win32 > > Christianhttp://www.dowski.com Can TASKKILL kill threads? For the TASKKILL command TASKKILL /F /PID 1234 , I gave thread id instead of PID It didnt throw any error. Does that mean that thread is really killed, releasing all its resources> How can I ensure that the thread is killed? -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill thread
En Mon, 09 Apr 2007 06:14:26 -0300, Teja <[EMAIL PROTECTED]> escribió: > 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()??? As you can read on: http://msdn2.microsoft.com/en-us/library/kdzttdcb(VS.80).aspx if you use this C runtime function, you should call _endthreadex() (from the same thread you want to end!) I wonder, why don't you use the thread support already present in Python? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Kill thread or at least socket.getaddrinfo
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 try: self.sock = socket.socket(af, socktype, proto) Now if the user press the cancel button, I'd like the connection to imidiatly stop. I run self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() Dunno if they are both nessesary. I normaly use only the first, but it makes no difference to use both. If python is at the actual connection in socket.socket( this work fine, but if python is at calling socket.getaddrinfo(, it doesn't stop. I also can't kill the thread, as it is afaik not a possibility in python. Is there any other way to do this? -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill thread or at least socket.getaddrinfo
On Mar 26, 10:53 am, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > 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 > try: > self.sock = socket.socket(af, socktype, proto) > > Now if the user press the cancel button, I'd like the connection to > imidiatly stop. I run > self.sock.shutdown(socket.SHUT_RDWR) > self.sock.close() > Dunno if they are both nessesary. I normaly use only the first, but it > makes no difference to use both. > > If python is at the actual connection in socket.socket( this work fine, > but if python is at calling socket.getaddrinfo(, it doesn't stop. > > I also can't kill the thread, as it is afaik not a possibility in python. > Is there any other way to do this? This is addressed to some degree on a wxPython wiki at: http://wiki.wxpython.org/index.cgi/LongRunningTasks I think you can also use the join() method. I've also heard that if you know the pid, you can kill it, but that's not always a clean way of accomplishing the task. Mike -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill thread or at least socket.getaddrinfo
On 26 Mar., 18:08, [EMAIL PROTECTED] wrote: > you know the pid, you can kill it, but that's not always a > clean way of accomplishing the task. So I have to open the connection in a new process... Sigh.. How I hate this part of Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Kill thread or at least socket.getaddrinfo
On 10 Apr 2007 11:07:51 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On 26 Mar., 18:08, [EMAIL PROTECTED] wrote: > > you know the pid, you can kill it, but that's not always a > > clean way of accomplishing the task. > > So I have to open the connection in a new process... Sigh.. How I hate > this part of Python. > This isn't a python problem. You can't cleanly or safely kill threads, period. If you have to use blocking functions like this (you don't, you might consider using Twisted for your networking instead) the way you "cancel" it is to just stop waiting for the response and discard the response (or error) when it eventually comes. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list