TRefArray can not be used in multithread mode
Apparently TRefArray does nasty things when allocating memory and in the multithread mode we get random segfaults. This is actually explained very well in the comments at the beginning of the source file:
- All elements of a TRefArray must be set in the same process,
In particular, one cannot modify some elements of the array in
a different process.
TRefArray can not switch to new TProcessID if they already contain objects.
If you want to keep the data structure as it is, there will be no way to run the reconstruction in multithread mode.
However it seems to me that there is a solution, suggested again in the comments of the source file
Use an array of TRef when one of the above restrictions is met.
It will be even better if we use std::vector<TRef>
Updated by Karadzhov, Yordan over 8 years ago
Just to keep the record.
Replacing TReffArray with std::vector<TRef> doesn't solve the problem. However I found here:
that in ROOT one have to call the "magical" static function
in order to enable the thread support. This seems to solve my problem entirely.