killing thread ?

Rich Harkins rich at worldsinfinite.com
Fri Jan 24 12:09:42 EST 2003


On Fri, 2003-01-24 at 11:54, Skip Montanaro wrote:
> 
>     Paul>     [phr at localhost]$ kill -l
> 
>     ...
> 
>     Paul> Pick one of the unused ones from the above (probably from the
>     Paul> 33-61 range).
> 
> My MacOSX system only goes up as high as 31 (SIGUSR2).  Is calling kill(47)
> going to be defined?
> 
> Skip
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

Sadly, the only way to actually accomplish this in a cross-platform way
(AFAIK) is to route ALL blocking calls through select/poll (or
equivilent) and maintain a tickler UDP socket that is merged with any
pending reads so that a kill can force thread wakeup by sending through
the tickler.  It's messy, doesn't stop the infinite loop case, difficult
to do right, and can kill performance -- but it's not impossible.  

BTW, is this what Java did for a while back in the 1.0 days?  I seem to
recall it claiming to be able to kill threads and I always wondered
how.  I notice that Java no longer implies that killing a thread is
possible or safe anymore.

Rich







More information about the Python-list mailing list