embedding: forcing an interpreter to end

Diez B. Roggisch deetsNOSPAM at web.de
Mon Dec 20 07:49:08 EST 2004


Hi,

> I've googled my heart out and reread the threading API countless times.
> Any suggest or hints would be greatly appreciated.

You might have used the wrong keywords - the subject of killable threads
comes up every month once or twice, and usually is discussed to some
length. There exist some solutions to this problem that use tracing [1] to
forcefully terminate a thread, but these of course only work if the source
of trouble is a sequence of statements, not a single blocking one.

I myself had a similar problem a few days ago, and started using fork() and
killing the subprocesses. Right after I implemented my little framework, I
found that QThread from qt had a terminate method. Fearing my work had been
uneccessary, I tried to use them - and found that not only my thread, but
the whole program died when terminating the thread. That was because of
omniorb beeing in an inconsistent state.

Maybe you don't experience this using your code, but it certainly proved
that the arguments for deprecating thread terminating methods in java and
obmitting them in python seem to be valid.

[
[1]http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/ace7c98ef31bbf2d/2af9df4b63a48cbc?q=python+killable+thread&_done=%2Fgroups%3Fq%3Dpython+killable+thread%26hl%3Den%26lr%3D%26ie%3DUTF-8%26c2coff%3D1%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#2af9df4b63a48cbc
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list