| Starting with 2.4.7, libxml makes provisions to ensure that concurrent
threads can safely work in parallel parsing different documents. There is
however a couple of things to do to ensure it: 
configure the library accordingly using the --with-threads optionscall xmlInitParser() in the "main" thread before using any of the
    libxml API (except possibly selecting a different memory allocator) Note that the thread safety cannot be ensured for multiple threads sharing
the same document, the locking must be done at the application level, libxml
exports a basic mutex and reentrant mutexes API in <libxml/threads.h>.
The parts of the library checked for thread safety are: 
concurrent loadingfile access resolutioncatalog accesscatalog buildingentities lookup/accessesvalidationglobal variables per-thread overridememory handling XPath is supposed to be thread safe now, but this wasn't tested
seriously. Daniel Veillard |