[ANNOUNCE] Garbage collection for Python

Just van Rossum just at letterror.com
Sat Apr 15 06:38:03 EDT 2000


At 10:22 AM +0200 15-04-2000, Boris Borcic wrote:
>Just van Rossum wrote:
>>
>> - Will Ware and I have worked hard on a complete rewrite of the
>>   uthread module. It is a *vast* improvement over the old one.
>>   It offers a very nice thread object and several handy threading
>>   widgets. It already can do stuff threading.py can only *dream*
>>   about, like pausing (blocking) a thread from another thread or
>>   posting an exception from another thread (!).
>
>Simple examples of useful new idioms that this permits ?

Not sure about general new idioms, but I use it in an experimental version
of my MacPython IDE like so:
When the user starts a script, it gets executed in a new thread, allowing
the main GUI thread to continue to do it's work, as well as the user. The
cool thing is, the user can *pause* a running script at any given time, eg.
to inspect how the program is doing so far. Posting exceptions is useful in
a similar way: if user want to interrupt a running program, it just pushes
the "stop" button, and a KeyboardInterrupt (or SystemExit, I still don't
know what would be better) exception is posted from the "main" thread to
the running thread, making it stop gracefully. The builtin
KeyboardInterrupt mechanism always causes the KeyboardInterrupt to appear
in a random thread, which is not good.

Just






More information about the Python-list mailing list