killing thread ?

Peter Hansen peter at engcorp.com
Fri Jan 24 16:36:55 EST 2003


Uwe Schmitt wrote:
> 
> Uwe Schmitt <uwe.schmitt at procoders.net> wrote:
> 
> > But what if I want to end a thread which hangs because
> > it uses 'exec' on some code which loops forever ?
> 
> so, what about a new PEP : extend the exec method by limiting
> the execution time and memory usage ...

I'd support a PEP that proposed being able to set a flag in
a thread or in the interpreter so that a SystemExit exception
would be thrown at the very next bytecode instruction that gets
executed.

It's not foolproof, for those attempting to defeat it, and it 
still can't handle threads that are blocked in OS calls, but
it works for many of the cases that people think they want it
for, and it would suit me in all cases that I care about.

-Peter




More information about the Python-list mailing list