[Glade-users] Threading with GTK/Glade



I read back some of the discussions on this list about threads and I
didn't see any definitive answers there.  The discussion and url to
the thread/event Usenix talk
(http://lists.ximian.com/archives/public/glade-users/2000-November/000174.html)
was quite good.  Despite the excellent reasons against threads I still
feel I need them and I have some questions about the best way to do
it.

I write software for custom manufacturing fixtures to test, calibrate
and customize the company's "gizmos".  A typical fixture will have 6
channels.  Each channel has a serial port to communicate with a
"gizmo" and depending on if it is a configuration station or a test
station it may also have custom hardware to test with and a GPIB to
communicate with a shared calibrated multimeter.

I have created other programs that used the company's legacy OS/2
(don't laugh) platform or Windows NT or more recently I created a new
line of linux software.  Each one used threads and the linux one used
curses I/O for simple run status of each channel.  In Windows I used
Borland C++ builder which provides a Synchronize method to allow
threads to block while a "callback" like function is called from the
UI thread.

I beleive that while there are advantages to event based programs for
UI and socket based programs the amount of state information required
to run one of my programs makes a thread based program much more
desirable.  Then I can write straight line code that blocks on the
serial and GPIB functions and all state information is implicit in the
code.

Now assuming I still want to use a thread based program with Glade and
GTk what is the best way to let 6 asynchronous threads occasionally
access the their own set of widgets on a window.  I like the way the
Borland Synchronize() method works to guarantee the UI thread is the
one accessing the UI.  If there was something similar for Gtk that
would be great.  Or if the UI itself was thread safe but comments on
the list suggest this isn't true.

That leaves either a technique to trigger an event for the UI thread
or a seperate thread that handles the UI.

Does anyone who has done something similar with Gtk have any ideas or
suggestions?

Thanks,

jv










[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]