RE: [xml] question about multi-threaded-ness of libxml2



Follow up on my question 1 below:

If I were to call xmlInitParser() before I start creating threads, but within the threads, I call the parser 
several times (say to encode SOAP/XML messages) without calling xmlCleanupParser().  How then is the 
xmlDocPtr cleaned up for
each invocation of the parser within a thread?

Thanx,

M. Jones

-----Original Message-----
From: Jones, Mark A (Mark) 
Sent: Wednesday, June 02, 2004 8:40 AM
To: 'veillard redhat com'; Jones, Mark A (Mark)
Cc: xml gnome org
Subject: RE: [xml] question about multi-threaded-ness of libxml2


Daniel,

Thanx for the speedy response.  I have two more questions:

1.  I am in doubt as to what xmlCleanupParser() is cleaning up and I would 
prefer not to call it.  My concern then would be how to get cleanup the global memory that the parser used.

2.  I noticed that there is a compile time flag called "LIBXML_THREAD_ENABLED".  Do I need to compile the 
libxml2 libraries with this flag to ensure MT saft-ness?

Thanx,

M. Jones

-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com]
Sent: Wednesday, June 02, 2004 8:26 AM
To: Jones, Mark A (Mark)
Cc: xml gnome org
Subject: Re: [xml] question about multi-threaded-ness of libxml2


On Wed, Jun 02, 2004 at 08:14:16AM -0400, Jones, Mark A (Mark) wrote:
libxml2 seems to use a good amount of global memory (as in the cleanup work being done in 
xmlCleanupParser()).  Is there something special that I need to do for this to work in a MT environment?

  Call xmlInitParser() once before starting multithreaded operations.
Call xmlCleanupParser() only once if your program ends up not using the
libxml2 library anymore, in doubt do not call xmlCleanupParser() ever.
  Lots of people are using libxml2 in threaded environments, it should 
work.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]