I think xercesInitialize() already makes sure it only does its work once. If so the s_initialized can go away. Either way, this change isn't thread safe. The thread safe mechanism is to use std::call_once.