Additional thread safety fixes for root.

See also cms-sw/root#33.