Re: [xml] xmlInitParser and xmlCleanupParser



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

 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 xmlsoft.org 
   -> 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 ?
    http://xmlsoft.org/search.php?query=xmlCleanupParser

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.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]