Safe, High performance, reuseable

Wednesday, June 28, 2006

Thread safe MSXML

Question:
I'm using DOM and SAX API (MSXML version 4.0). An example:

IXMLDOMDocument2Ptr dom = NULL;
HRESULT hr = dom. CreateInstance(__uuido(MSXML2::DOMDocument40));
if (FAILED(hr))

Each thread have its own copy (copy of above
code). Is this thread safe?


Answer:
Its not thread safe because you are using DOMDocument
(MSXML2::DOMDocument40). In order for it to be thread safe, you'd have to
use FreeThreadedDomDocument

Msxml2.FreeThreadedDOMDocument.4.0
TheadModule: Both

No comments: