peter at engcorp.com
Wed Apr 14 18:06:08 CEST 2004
> Paul Rubin wrote:
>> Irmen de Jong <irmen at -nospam-remove-this-xs4all.nl> writes:
>>> Can't you do something smart with signals, threads, alarm() and kill() ?
>>> Like running the code in a worker thread, where the main thread
>>> keeps track of how long it has been running and if not finished
>>> within a certain time, kill() it.
>> How do you kill a thread from another thread? I don't know of any way
>> to do that.
>> Maybe it's safest to run the user script in a separate process and
>> communicate through a socket or through shm. That allows using the
>> normal OS features for resource limits, file protection, etc.
> My exploration into threads indicated that you can't kill one thread
> from another.
http://www.strakt.com/docs/os03_threads_interrupt.pdf has some info
about an approach (via a C extension only) which can be used in 2.3
to do it.
More information about the Python-list