Does anybody know if xerces lib is thread safe

C

cis.imendel

I my code 2 different threads at the same time called xercesc code.
T1: new SAXParser();
T2: XMLPlatformUtils::Initialize();
They both called a function with this code:
{
try {
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
std::cout << "Error during initialization! :\n"
<< message << "\n";
XMLString::release(&message);
return;
}

const char xmlFile[] = "file.xml";

_parser = new SAXParser();
...
}

_parser is a global variable.
The code crashes when one thread is in Initalize(); and the other
thread is in new SAXParser();
They both call some XMemory code.
Any comment on the thread safeness of the Xerces?

}
 
V

Victor Bazarov

[..]
Any comment on the thread safeness of the Xerces?

Doesn't Xerces have its own web site? I found this within less than
one minute of looking:
http://xml.apache.org/xerces-c/

Aren't there any forums that talk *specifically* Xerces? At least on
the web site (the link above) there are "User Mail Archives" and
"Devel Mail Archives", have you looked at them yet?

Also consider that C++ has no threading built-in, and that's why the
commonly multithreading is discussed in the 'comp.programming.threads'
newsgroup.

V
 
B

Boris Kolpackov

Hi,

I my code 2 different threads at the same time called xercesc code.
T1: new SAXParser();
T2: XMLPlatformUtils::Initialize();

...

Any comment on the thread safeness of the Xerces?

Xerces-C++ is thread-safe except for the calls to Initialize() and Terminate().
So you need to make sure you don't initialize the runtime from two threads
simultaneously.

hth,
-boris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top