You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Vladimir Marek <ma...@printsoft.cz> on 2004/01/12 09:01:46 UTC

Xerces multitread

Hello,

I would like to write multithreaded application using xerces. Each
thread will use completely sepparated DOMDocument. I tried to create two
distinct DOMImpementatios, but that always crashes xerces.

For example in DOMCount after:
    // Instantiate the DOM parser.
    static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
    DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS);
    DOMBuilder *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);

I Added:
    static const XMLCh gLS2[] = { chLatin_L, chLatin_S, chNull };
    DOMImplementation *impl2 = DOMImplementationRegistry::getDOMImplementation(gLS2);
    DOMBuilder *parser2 = ((DOMImplementationLS*)impl2)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);

Is this the wrong way ?

So I tried to use single DOMImplementation for whole program, and make
every other xerces object new per thread (document, parser,
serializer, etc.). It works fine, however it's slower than singlethread
solution, even that the computer has two processors. Is it possible that
Xerces uses some internal synchronization mechanizm which slowes me down
?

Thank you
-- 
	VladimĂ­r Marek

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org