From: Antoon Pardon <[EMAIL PROTECTED]>
To: [email protected]
Subject: Re: [pygtk] PyGTK Thread problem
Date: Wed, 25 Apr 2007 11:49:12 +0200
On Sun, Apr 15, 2007 at 04:39:01AM +0000, Funky Fred wrote:
>
>
> Just to throw the idea out there:
>
> You can use a hybrid between idle_add & threads.
..... So if someone closes the gui, the best you can do is invoke a
> callback on the other thread that updates a flag, they hopefully check
that
> in time to shutdown before the gui closes and/or you exit python. This
can
> be problematic if your background threads do computationally intense
stuff
> and don't necessarily check their "die" flag in time.
Well I once wrote the following, to allow threads raising exceptions
in each other.
http://groups.google.be/group/comp.lang.python/msg/5833130893cee567?hl=nl&
Maybe the idea is usefull for you.
Hmm. It's definitely something I plan to keep in my head. I'm a little wary
of mucking with the interpreter at that level (that warning about "naive
use" of PyThreadState_SetAsyncExc in the documentation definitely would
apply to my knowledge level of python internals at this point). However, I
may end up having to...
For now, though, trying to get the threads to exit cleanly is an aesthetic
thing (a flag and sys.exit() does the job, albeit with the occasional
exception when a thread doesn't check it's flag in time). Heck just going
into process explorer and killing the thing is acceptable at this stage. But
this may change, and I'll be searching for this e-mail again....
Thanks for the tip!
-Stu
--
Antoon Pardon
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
_________________________________________________________________
Dont quit your job Take Classes Online and Earn your Degree in 1 year.
Start Today!
http://www.classesusa.com/clickcount.cfm?id=866146&goto=http%3A%2F%2Fwww.classesusa.com%2Ffeaturedschools%2Fonlinedegreesmp%2Fform-dyn1.html%3Fsplovr%3D866144
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/