Hi, rooters - what is the latest situation with thread safety in ROOT?
I have an application that uses a separate thread to grab ROOT objects created by end users (TH1 & ilk), serialize them and send them over a TCP connection to a different application (happily single-threaded, where users look at these objects).
It's a poor man's substitute for PAW/HBOOK shared memory histograms and it is used
mainly to look at live data produced by the MIDAS data acquisition system.
http://midas.psi.ch
http://daq-plone.triumf.ca/SR/rootana
All this was written some years ago, the ROOT world has moved on since then and now time has come to renew my code and I am not sure if my thread implementation is correct for the latest versions of ROOT.
So I look at the documentation and do not see happy results:
So what looking do I need to do in my thread?
I use things like tobject->InheritsFrom(), gRoot->FindObjectAny(), th1->Reset(), tdirectory->GetList(), new TKey(...), tobject->GetName(), TMessage, TList, TSocket (TSocket I believe is thread-safe), tdirectory->GetListOfKeys(), tkey->FindObject(), tfolder->GetListOfFolders(), etc
So what's thread safe and what is not? (Plus remember that the end user can create and destroy objects all the time at any time - my thread has to be protected against race conditions on access to destroyed objects (i.e. th1=FindObject(); /* object is deleted by user in the main thread */; th1->Reset(); /* boom!!! */).
For the curious, the actual code is here: http://ladd00.triumf.ca/viewvc/rootana/trunk/libNetDirectory/netDirectoryServer.cxx?view=markup it uses a mickey-mouse locking scheme in RootLock.cxx that does not use TThread::Lock (probably did not exist when my code was written).
-- Konstantin Olchanski Data Acquisition Systems: The Bytes Must Flow! Email: olchansk-at-triumf-dot-ca Snail mail: 4004 Wesbrook Mall, TRIUMF, Vancouver, B.C., V6T 2A3, CanadaReceived on Tue Feb 01 2011 - 18:14:56 CET
This archive was generated by hypermail 2.2.0 : Wed Feb 02 2011 - 11:50:01 CET