Re: [ROOT] how to protect TApplication with mutexes

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Feb 18 2000 - 08:32:25 MET


Hi Victor, Matevz,
We are planning to protect the two globals gFile and gDirectory in the
same way that we did we gPad.

Rene Brun

Victor Perevoztchikov wrote:
> 
> Hi Matevz,
> 
> > place to lock/unlock mutex that would prevent my threads from changing
> > global variables (like gDirectory when adding new histograms).
> 
> the problem is not so simple. The numerous globals in ROOT are very hard for
> threads, even if all of them are mutex-ed
> 
> Example:
> 
> Thread 1 open TFile1;
> Thread 2 open TFile2;
> Thread 1 create histogram.
> 
> Thread 1 thinks that its histogram in TFile1, but it is in TFile2, because
> global gFile was unpredictably changed.
> Mutex can not help here.
> 
> But in the next run it could be in TFile 1 or even in TFile 9.
> 
> So, for normal user TThread is very dangerous. It was intended to use only
> for online, where users much more familiar with such problems.
> 
> One global, gPad is defenced against it, each thread has own gPad,
> theoretically it is possible to do with others, but ...
> 
> Victor
> 
> Matevz Tadel wrote:
> >
> > Hi,
> > I'm running MyRint : public TRint within a thread. Where is the proper
> > place to lock/unlock mutex that would prevent my threads from changing
> > global variables (like gDirectory when adding new histograms).
> > I tried by redefining TApplication::Start/StopIdleing(), but i'm not
> > completely sure this is sufficient ... Could someone please elaborate on
> > the problem ...
> >
> > Thank you,
> > matevz
> >
> > ---------------------------------------------------
> >  Matevz Tadel,         E-mail: Matevz.Tadel@ijs.si
> >  Department of Experimental High Energy Physics F9
> >  Jozef Stefan Institute,  Jamova 39,  P.o.Box 3000
> >  SI-1001 Ljubljana, Slovenia
> >  Tel.: +386-61-177-3674      Fax: +386-61-125-7074
> > ---------------------------------------------------
> 
> --
> Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch
> Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
> tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET