Simple example of threading

Tres Seaver tseaver at starbase.neosoft.com
Thu Feb 24 12:37:43 EST 2000


In article <p0og96y6a4.fsf at gups.holylane.de>,
Dirk Vleugels  <dvl at de.uu.net> wrote:
>
>Hi,
>
>rmeegan at murlmail.com writes:
>> [Thomas Weholt]
>> There is something to be said for spawning new processes to handle 
>> server requests. In particular, parent processes can kill their 
>> children when they wander off and start misbehaving. Threads can't be 
>> killed by other threads, including the main thread of the process that 
>> spawned them.
>
>Is this true? Under posix_threads there is pthread_cancel. This call
>is used to 'cancel' misbehaving threads (blocking on certain system
>calls (see doc)). The thread may ignore cancel requests, but this is
>under user control. 
>
>Sadly, pthread_cancel is missing in python, dunno why.

Thread cancellation is both highly unportable and highly dangerous -- the
cancelled thread doesn't get to clean up on its way out.  "Don't go there"
is pretty good advice, I've found.

Erinye'ly,

Tres.
-- 
---------------------------------------------------------------
Tres Seaver           tseaver at palladion.com       713-523-6582
Palladion Software    http://www.palladion.com



More information about the Python-list mailing list