[Python-3000] improved threading in py3k (original) (raw)

Josiah Carlson jcarlson at uci.edu
Sat Aug 5 00:16:33 CEST 2006


"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote:

"tomer filiba" <tomerfiliba at gmail.com> writes:

> once a thread is created, there is no way to kill it externally. > which is a pity, since the thread must be "willing" to die, Doing that unconditionally is impractical: the thread has no way to protect itself from being killed at moments it has invariants of shared data temporarily violated. I agree that it should not require continuous checking for a thread-local "ask to terminate" flag spread into all potentially long-running loops, i.e. it requires a language mechanism. But it must be temporarily blockable and catchable. Here is how I think the design should look like: http://www.cs.ioc.ee/tfp-icfp-gpce05/tfp-proc/06num.pdf

I did not read all of that paper, but it seems to rely on the (un)masking of signals in threads, as well as the sending of signals to 'kill' a thread. One problem is that Windows doesn't really allow the sending/recieving of any non-process-killing signals, so it would be a platform-specific feature.

If you want a sample implementation of that kind of thing, SAGE (http://modular.math.washington.edu/sage/) performs signal masking/unmasking to stop the execution of underlying computation threads.



More information about the Python-3000 mailing list