Re: [[libxml++] Thread safety?]
- From: Christophe de Vienne <cdevienne alphacent com>
- To: libxmlplusplus-general lists sourceforge net
- Subject: Re: [[libxml++] Thread safety?]
- Date: Sun, 14 Sep 2003 14:25:26 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Le Dimanche 14 Septembre 2003 14:18, Fredrik Arnerup a écrit :
>
> 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.
In fact there is a global init step that set up the callbacks for Node
instanciation. You'll find in document.cc.
>
> I see three options:
>
> * Call xmlInitParser() from the constructor of some global static object.
I think it's the right solution, since this global static object already
exists (it's Document::Init).
Cheers,
Christophe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/ZF47B+sU3TyOQjARAmReAKCOjuthTjyjqlpn1pKOBYm7TETm4wCeKXVz
pQ0xvWjR6uX0ZgfQVD986Gs=
=1UFp
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]