Hi Thomas,
You should never create a TROOT object. Only one instance of TROOT
can exist in the main thread.
Currently you have to protect several ROOT classes that are
not thread safe (in particular creation and closing of files).
See an example in tutorial threadsh1.C
It is our intention to protect gDirectory (like we already did
for gPad) when running with threads.
Rene Brun
On Tue,
16 Aug 2005, Tomasz Bold wrote:
> Dera ROOTers,
> Is it possible to have multiple TROOT instances in every thread?
> The problem is that the usage of gDirectory common for all the threads
> screws up the navigation which uses it.
>
> The feature I expect is to have separate TROOT in each thrad.
> I tried to do as follows:
> void runit(int *tid)
> {
> ostringstream rname;
> rname << "r" << pthread_self() << ends;
>
> TROOT r(rname.str().c_str(), "R");
> gROOT = &r;
> gDirectory = gROOT;
> and later as usually bookking and writing but it crashed.
>
> Is this the recomended method of using ROOT in multithread environment or it
> is better to secure each file operation by mutex.
>
> I attached the code example.
>
> Regards,
> Tomasz Bold
>
Received on Wed Aug 17 2005 - 09:01:57 MEST
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:11 MET