Re: [ROOT] Multithreaded GUI, TRootEmbeddedCanvas

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Aug 20 2001 - 12:09:46 MEST


Hi Thomas,

  X11 is not multithread safe. The only safe way is to use synchronous timers
or to use threads that only set for example the Modified() flag and possibly
call TGClient::ForceRedraw() to give redrawing of widgets priority over handling
events.

Cheers, Fons.


Thomas Bretz wrote:
> 
> Hello,
> 
> I have some trouble with the following:
> 
> I have a class derived from TApplication. In its constructor I create a
> GUI (a class derived from TMainFrame, which creates two instances of a
> class derived from RootEmbeddedCanvas) and a thread. The thread calls
> GetCanvas()->Modified() and GetCanvas()->Update() for both embedded
> canvases after updating its contents in a loop.
> In most cases I get some X11 error about invalid Pixmaps. I guess it is
> because TApplication::Run() and the GUI-Update-Loop are running in
> different threads. How can I work around this? (Maybe I could use
> timers, but for me it is important to run the updating thread with less
> priority than the main thread).
> 
> Can somebody help me?
> 
> Thanks,
> Thomas.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



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