threads killing other threads

Aahz Maruch aahz at panix.com
Thu Mar 7 21:24:54 EST 2002


In article <a41fsq$bvf$1 at newsreader.mailgate.org>,
Les Smithson  <lsmithso at NOhare.SPAM.demon.co.uk> wrote:
> "Aahz" == Aahz Maruch <aahz at panix.com> writes:
>> In article <a40h4g$kl5$1 at newsreader.mailgate.org>,
>> Les Smithson  <lsmithso at NOhare.SPAM.demon.co.uk> wrote:
>>>
>>>  I'm sure there's a good reason for Python not implementing
>>> this. Anyone know what it is?
>>
>> Yes.  It doesn't work.
>>
>> Oh, sure, there's a long technical explanation of how arbitrarily
>> killing threads leaves processes in various kinds of weird states,
>> but it all boils down to, "It doesn't work."  That goes double for
>> any kind of cross-platform facility.  Note that Java has pretty much
>> abandoned any pretence that it can provide this capability.
>
>But doesn't pthread_testcancel allow cooperative threads to be
>canceled? This is the portable equivalent to the thread signaling
>scheme described earlier. It also gives the canceled thread a chance to
>clean itself up before exiting.
>
>Not ideal, but better than nothing.

After looking this up, I see two basic problems with this:

* Doesn't work with extensions unless the extension writer cooperates.

* Don't see any direct equivalent in Win32.  Solaris native threads
don't support this; I don't know off-hand whether Python uses pthreads
on Solaris.
-- 
                      --- Aahz  <*>  (Copyright 2002 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista

"Argue for your limitations, and sure enough they're yours."  --Richard Bach



More information about the Python-list mailing list