Blame doc/threads.html

Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="SHORTCUT ICON" href="/favicon.ico" /><style type="text/css">
Packit Service a31ea6
TD {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
Packit Service a31ea6
H1 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
H2 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
H3 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
A:link, A:visited, A:active { text-decoration: underline }
Packit Service a31ea6
</style><title>Thread safety</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000">
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

The XML C parser and toolkit of Gnome

Thread safety

<center>Developer Menu</center>
<form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form>
<center>API Indexes</center>
<center>Related links</center>

Starting with 2.4.7, libxml2 makes provisions to ensure that concurrent

Packit Service a31ea6
threads can safely work in parallel parsing different documents. There is
Packit Service a31ea6
however a couple of things to do to ensure it:

    Packit Service a31ea6
      
  • configure the library accordingly using the --with-threads options
  • Packit Service a31ea6
      
  • call xmlInitParser() in the "main" thread before using any of the
  • Packit Service a31ea6
        libxml2 API (except possibly selecting a different memory allocator)
    Packit Service a31ea6

    Note that the thread safety cannot be ensured for multiple threads sharing

    Packit Service a31ea6
    the same document, the locking must be done at the application level, libxml
    Packit Service a31ea6
    exports a basic mutex and reentrant mutexes API in <libxml/threads.h>.
    Packit Service a31ea6
    The parts of the library checked for thread safety are:

      Packit Service a31ea6
        
    • concurrent loading
    • Packit Service a31ea6
        
    • file access resolution
    • Packit Service a31ea6
        
    • catalog access
    • Packit Service a31ea6
        
    • catalog building
    • Packit Service a31ea6
        
    • entities lookup/accesses
    • Packit Service a31ea6
        
    • validation
    • Packit Service a31ea6
        
    • global variables per-thread override
    • Packit Service a31ea6
        
    • memory handling
    • Packit Service a31ea6

      XPath has been tested for threaded usage on non-modified document

      Packit Service a31ea6
         for example when using libxslt, but make 100% sure the documents
      Packit Service a31ea6
         are accessed read-only !

      Daniel Veillard

      </body></html>