[Python-bugs-list] [Bug #121115] Kill threads from main thread

noreply@sourceforge.net noreply@sourceforge.net
Thu, 2 Nov 2000 10:49:43 -0800


Bug #121115, was updated on 2000-Nov-02 07:51
Here is a current snapshot of the bug.

Project: Python
Category: Modules
Status: Open
Resolution: None
Bug Group: Feature Request
Priority: 5
Summary: Kill threads from main thread

Details: It still isn't possible to kill a thread from another thread. This is an important feature for long running processes as multithreaded application servers. It should be possible for the main thread (or another thread) to kill a non responding thread after a timeout.

As I read in a discussion forum "pthreads" support somewhat like thread_cancel() for Windows I don't know.

If this feature became implemented it would be nice if an ThreadObject from the module "threading" could be killed by deleting the object.

Follow-Ups:

Date: 2000-Nov-02 09:31
By: gvanrossum

Comment:
This is a very controversial feature. If a thread owns a resource (e.g. it holds a lock), what happens to the resource when the thread is killed?

The best idea I can come up with is to make it possible to send asynchronous exceptions to threads -- but this doesn't help for threads that are blocked in an I/O operation. That might be solved through sending signals, but that's a Unix-only solution, and probably isn't even consistent across different Unix thread implementations.
-------------------------------------------------------

Date: 2000-Nov-02 10:49
By: holtwick

Comment:
Blocking I/O operations are a problem, but what about other internal problems like endless loops? An asynchronous exception would be a good way for most problems (I have with threads ;) And as far as the documentation says, signals always go to the main thread. If that is so, it doesn't help much. 

So what about connecting signals to threads. I don't know if this is possible, but a reliable way to use signals with threads would be a way to give threads a timeout.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=121115&group_id=5470