killing thread ?

"Martin v. Löwis" martin at
Fri Jan 24 17:14:39 CET 2003

Paul Rubin wrote:
> The interpreter loop can check whether there's a kill pending for
> any other threads (that's just looking at a flag that will be false
> almost all the time).  

No need for that: the implementation of thread.cancel could do that 
right away. However, it cannot know whether the target thread is in a 
blocking system call - nor could the interpreter loop of another thread 
know for sure.

> If there's a kill pending, the interpreter sends a signal to
> the target thread.  That should unblock any blocked i/o.

Which signal specifically?

> A global signal handler then raises an exception in the
> target thread which gets handled the usual way.

What if the signal is blocked?

> That does leave the target thread able to catch the exception
> and keep looping.  Even still, it improves on the present situation.

How do I do that on Windows? On HP-UX? On Irix? With Gnu threads?


More information about the Python-list mailing list