Re: [[libxml++] Thread safety?]
- From: Fredrik Arnerup <e97_far elixir e kth se>
- To: Fredrik Arnerup <e97_far e kth se>
- Cc: Murray Cumming <murrayc usa net>, libxmlplusplus-general lists sourceforge net
- Subject: Re: [[libxml++] Thread safety?]
- Date: Sun, 14 Sep 2003 14:18:43 +0200
On Sat, Sep 13, 2003 at 09:43:33PM +0200, Fredrik Arnerup wrote:
> On Sat, Sep 13, 2003 at 09:35:01PM +0200, Murray Cumming wrote:
> > Fredrik Arnerup <e97_far elixir e kth se> wrote:
> > > I managed to resolve the problem by adding a call to xmlInitParser() in the
> > > main() of my program as described here: http://xmlsoft.org/threads.html
> >
> > ...
> >
> > After investigating, you might try providing a patch to do that.
Ok, here's the story:
xmlInitParser() should be called only once, and only by the main thread
before any other libxml calls. The purpose is to initialize global data,
which normally get initialized automatically when needed, but in a threaded
program, that might not be reliable, so you should call xmlInitParser()
explicitly. It should therefore be safe to call it for any program.
The problem is that libxml++ does not have a global init step (am I right?)
and calling xmlInitParser() from each parser constructor is not the correct
thing to do.
I see three options:
* Call xmlInitParser() from the constructor of some global static object.
* Wrap xmlInitParser() and tell people to call it.
* Leave it as it is and tell people to call xmlInitParser().
/Fredrik Arnerup
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]