Lock access to global functions list

TFormula accesses the gROOT->fGlobalFunctions list and therefore it needs to be properly locked for serialization.