Put mutex around XInitThreads call, making sure it is only called once.