Re: [ROOT] GUI classes with TThread

From: Joern Adamczewski (J.Adamczewski@gsi.de)
Date: Wed Jan 21 2004 - 14:17:32 MET


Hello Kerry,

we have tested the combination of ROOT GUI with TThreads intensivly
in the development of the go4 analysis framework project, that also
intends a non blocking histogram display for monitoring.

"LEE, KERRY T. (JSC-SR) (UHCL)" wrote:
> I am attempting to create an online histogram monitoring GUI, in which
> many
> histograms are filled , but only displaying a few at a time.  I

> interact with the GUI and change the histogram display.  My next step
> was to
> introduce TThreads via the TThreadframe example.  Unfortunately I did
> this
> before coming across the previous message
> 
> http://atlassw1.phy.bnl.gov/doc/root/RootHtmlDoc/roottalk/roottalk99/161
> 9.ht
> ml
> 
> which states that "Access to TCanvas, TPad and other graphics from
> threads.
> Does not work, even if access is locked explicitly.

I'm sorry, but this information might not be up to date. Since these
findings (1999) some modifications were done in the TThread package that
assure you can access the TPad from inside threads (however, the
TPad should be _created_ outside the thread..)

Instead of the old TThreadframe example, you might use the more developed 
Go4Threadmanager package to implement your application. 
It is freely vailable at 
http://www-w2k.gsi.de/go4/packages.htm

It contains an example showing the filling of histograms from two threads
in different TPads.
The go4 threadmanager is better tested than the previous examples and
is part of the go4 kernel now. It can be used without the rest of go4
though. 

However, instead you might follow Fons' advice using the frequent
gSystem->ProcessEvents() calls without implementing TThreads at all.

Another possibility avoiding threads is the usage of the TTimer class 
for frequent actions that shall not block the gui eventloop.

It depends on the complexity of your application if it is worth
dealing with threads here...

Best regards,

Joern

-- 
/////////////////////////////////////////////////////////////////////
// Dr. J"orn Adamczewski                    (J.Adamczewski@gsi.de) // 
// GO4 project team                         Tel: +49-6159-71-1337  //
// Datenverarbeitung & ExperimentElektronik FAX: +49-6159-71-2986  //
// Ges. f. SchwerIonenforschung, Planckstr.1,  D-64291 Darmstadt   //



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET