On Sun, 2005-08-28 at 22:46 -0700, Brian wrote:
> To handle threads and inter thread communication You have a couple
> options.  There is a dispatcher.py project out there that can handle all
> sorts of inter process communications, etc..  We have come up with a
> small simple way of handling threads and gtk callbacks.
> 
> I've attached a small dispatcher.py script and an example script that
> shows how to use it.  This dispatcher code has fixed a lot of bugs and
> intermittent problems with our project.  It does a great job of
> separating code and callbacks when dealing with threads.
> 
> It allows you to run all gtk/gui calls from one thread while other
> threads can trigger callbacks and pass data into or out of a thread.
> 
> The dispatcher code can reside in any thread and receive calls from any
> other thread.  For our project the dispatcher instances all belong to
> the main gtk thread and receive signals from feeder threads.  It is
> engineered generic enough to be able to pass any python data between
> threads.

  Your dispatcher uses pipes and io watch.  That's ok, but you could
simply use gobject.idle_add() to "send messages" to the main thread
(running the main loop) in a safe way.  Have you tried it?  It's quite a
bit simpler...

  Regards.

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to