ROOT Version: latest
Platform: linux
Compiler: whatever
Hello!
I am about to start yet another project with ROOT, and as usual, I would like to use multiple threads to read and write to different TTrees.
It is not my first attempt at multithreading with ROOT and I have been burnt before. In the past, I developed a very nice Python program that dynamically spawned many threads and even chained them one with another. I have spent considerable time and effort to unit test, document, and debug the thing, just to see it fail miserably because of the ROOT’s wacky support for multi-threading. You never know which part of ROOT is thread-safe and which not, leading to random crashes, dead-locks, and so on and so forth.
So this time I do not want to rush things up. I am here to get advice about what is the best way to proceed.
These are my requirements:
- Working in Linux
- Working on single local machine
- C++11 (No Python, no bash scripts, just plain old C++11)
- Can use boost
- Latest version of ROOT (let’s say from 6.18+)
- Each thread reads from and writes to a different TTree (so TTrees are not shared among threads)
- The threads are joined at some point because I need to “merge” all the TTrees together. This merging can be done in a single thread, so nothing to worry about.
- No histograms, no plotting, no fitting is involved (I have been burnt before by that)
Here are some options on the top of my head:
- C++ std::thread
- ROOT TThread
- ROOT PROOF
- pthread
- boost.asio
Which one is the most stable? I am not interested in ease of use. I just want my program not to crash. That’s all.
Thank you
Giorgio