Killing a thread from a 'controller' 
Author Message
 Killing a thread from a 'controller'

*Messing around with threads* in the project I am working in now I
have a bunch of threads doing some work, and a watchdog that keeps en
eye at these threads..

What I now would like to do is to kill one of the threads from the
watchdog, at the beginning I thought that something like
thread.exit_thread() could be useful, but.. naah *DRATS*

So is there any good way of killing a thread?

Basically the thread function is a method of a class, probably stuck
in getting a webpage or so.

        /andy



Tue, 15 Feb 2000 03:00:00 GMT  
 Killing a thread from a 'controller'

Quote:
> *Messing around with threads* in the project I am working in now I
> have a bunch of threads doing some work, and a watchdog that keeps en
> eye at these threads..

> What I now would like to do is to kill one of the threads from the
> watchdog, at the beginning I thought that something like
> thread.exit_thread() could be useful, but.. naah *DRATS*

> So is there any good way of killing a thread?

Alas, there is not.  When we designed the interface for threads, posix
threads wasn't there yet, and we decided to provide only the absolute
minimum of functionality that we were sure we could implement on any
platform that had some kind of native threads.  Killing a thread
wasn't on our list.  And anyway it has all sorts of dangerous aspects
which I believe posix threads only allows you to control with much
hassle.

Quote:
> Basically the thread function is a method of a class, probably stuck
> in getting a webpage or so.

You can use select with a timeout to implement something like it.  One
trick I recently learned is how to make a connect() call nonblocking;
I believe Deja News should have it.

--Guido van Rossum (home page: http://www.python.org/~guido/)



Tue, 15 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Thread#kill doesn't kill processes inside a thread

2. kill '-SIGHUP', pgid -vs- kill 'SIGHUP', 0

3. Killing processes without using 'kill'

4. Vispro Rexx can't kill a rxftp thread

5. Please help- Killing Python 'processes'

6. Threads in Python version 1.5, thread doesn't start until calling process dies

7. Threaded server doesn't run its threads

8. Where is module 'thread'?

9. 'free' threading in Python question

10. FSU threads, Provenzano's threads, and python

11. How to kill a thread from another thread ?

12. threading: how to kill a (possibly blocked) thread?

 

 
Powered by phpBB® Forum Software