On Fri, 18 Feb 2005, Johan Dahlin wrote: > Brad Tonkes wrote: > >Hi, > > > >I've recently encountered some problems with threads in a (python) gnome > >panel applet. My problem is that any spawned threads don't seem to get > > > > > Don't use threads together with the panel applet code. > Neither ORBit, bonobo, nor orbit-python is thread safe. And the pygtk > code is less than perfect when it comes to threads. > I'd really advise you to use something other than threads.
Since I have am interfacing with a threaded, third party networking library I have only two options: (1) use threading, (2) fork a process and communicate using pipes or shared mem. Solution (2) is ugly and potentially less portable than solution (1). Solution (1) is straightforward: I am careful to only perform gtk/gnome operations within the mainloop thread, and the gtk-only version works perfectly, as did my gnome panel applet in the 1.x days and as of a few weeks ago in 2.x (x >= 2). Moreover, it is working just fine (for someone else) on Fedora core 2 (pygtk 2.2.0, gnome-python 2.0.0). My problem is that due to a (relatively) recent change somewhere, I cannot even get a spawned thread to run, even if it has nothing to do with gtk/gnome (as in my earlier example where the spawned thread just did a sys.stdout.write). Does anyone know if this is a change to pygtk, gnome-python, gtk+ or the gnome libs? Has the API for running threads in a gnome applet changed subtly somewhere between 2.0.x (known to work) and 2.6.x (not working), or have the libs been completely re-organised to preclude threads altogether? thanks, brad +----------------------------------+----------+----------------------------+ | Brad Tonkes, Research Fellow | | There were too many of us, | | Centre for Autonomous Systems, | _--_|\ | we had access to too much | | School of Computer Science and | / \ | money, too much equipment, | | Engineering | \_.--._* | and little by little, we | | UNSW, 2052 | v | went insane. | | NSW, Australia | | | +----------------------------------+----------+----------------------------+ _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
