Multithreading fixes for ROOT

see also cms-sw/cmssw#1941