Re: [ROOT] Windows Graphics/GUI - RE: More on Graphics abstraction (was Re: [ROOT] Qt ROOT)

From: Brett Viren (bv@bnl.gov)
Date: Mon Oct 29 2001 - 16:56:35 MET


Valeri Fine writes:
 > 
 > 
 > 
 > > Peter Lipa writes:
 > >  >
 > >  > What Valery, Thane and I are trying to tell you is that the gdklib's in
 > the
 > >  > current state are not suitable for root graphics/GUI. The lib is not
 > >  > threadsafe and crashes at random times.
 > >
 > > Gtk/Gdk is thread safe if all GUI related code is restriced to one
 > > thread.  There are utilities (http://www.humanfactor.com/gpk/) that
 > > help non-GUI threads make safe GUI calls.
 > >
 > 
 >  This is very reason of the current and future ROOT Windows problem
 >  with any GUI (gtk, qt, win32, mfc etc )
 >  Not all "GUI related code is restricted to one thread".

I looked at GPK at the URL above a little more closely.  It works by
wrapping all GTK+ (the underlying C code layer of Gtk--) function
calls with GPK equivalents.  The GPK versions are then thread safe
because instead of calling the GTK function directly they queue all
GUI requests and send them through a single pipe to the main GUI
thread which is started by GPK and which then does the actual GTK
call.

The reason why I mention this, is that if the trouble with Bertrand's
Windows GUI really is this treading problem, maybe he (or someone who
wants to help him) can create a similar layer.  Then all the other
higher layers are free to use threads and access GUI classes with out
worry.  Also, as much as I don't like the practice of using
interpreted code in compiled code, because we have
gROOT->ProcessLine(...), implementing this layer should be fairly
easy.

And if you are right, Valeriy, about this problem being endemic to all
GUIs, this kind of layer might be useful in ROOT at a higher level
than just Bertrand's port.  But, do I understand you correctly that
currently on unix/X we can't run threads with the TG classes without
worrying about this problem?

BTW, there are similar GUI/thread related discussions right now on the
Gtk-- list which includes how one person does this
pipe-to-the-gui-thread in C++.  If interested see:
http://marc.theaimsgroup.com/?l=gtkmm&m=100435666117355&w=2

Regards,
-Brett.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:05 MET