Re: [xml] xmlInitParser and xmlCleanupParser

On Tue, Sep 30, 2003 at 12:00:33AM -0700, Manu M P wrote:

 I am using libXml in a multithreaded program. 

Is it necessary to call xmlInitParser in each of thread before using the API?

  This has been rehashed to death, please read the archives and use
the search engine on 
   -> no

Is it necessary to call xmlCleanupParser corresponding to each xmlInitParser?

  -> NO only once when you have finished using the library in the program

Is there any problem if i called xmlInitParser multiple times in a single thread?

  -> No

Also even if never called xmlInitParser i can parse xml files. Why this happens?

  -> because the parser checks for initialization. This check is not
     atomic. if 2 threads do the same you will loose memory

  What about reading the docs, tutorials, etc ?


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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