By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Does anybody know if xerces lib is thread safe

P: n/a
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?

}

Jun 18 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
ci*********@gmail.com wrote:
[..]
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 18 '07 #2

P: n/a
Hi,

ci*********@gmail.com writes:
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

--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding
Jun 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.