Re: [xml] multithreading issue?



On Mon, Oct 18, 2004 at 01:02:02PM +0200, oliverst online de wrote:

I recognised, that some functions in the libxml2 are calling
xmlInitParser(). Isn't this function supposed to be called before the
parser is being used? And wouldn't there be a multithreading issue with
it, because xmlInitParser() isn't reentrant? 
Think of a multithreaded program, that calls multiple function witha
xmlInitParser() from differnet threads. It would surely call
xmlInitParser() more than once.

  void
  xmlInitParser(void) {
      if (xmlParserInitialized != 0)
              return;

http://xmlsoft.org/threads.html

 "call xmlInitParser() in the "main" thread before using any of the
  libxml2 API (except possibly selecting a different memory allocator)"

it's very clear. Call it before anything else ! If you don't you're not
following the guidelines.

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]