Thread safe Xerces-C setup / termination.

See http://xerces.apache.org/xerces-c/faq-parse-3.html#faq-6 for the limitations
on Xerces-C.

I ended up to use a single mutex both for initialization and termination because I need to guarantee the following:

- No thread can continue (possibly invoking Xerces functionality) without at least one thread terminating.
- No thread can invoke Terminate while something else might be calling Initialise at the same time.

@Dr15Jones, if you agree with the implementation, I can go ahead and clean-up all the bits which call the original Xerces-C functions.