Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • L libxml2
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 93
    • Issues 93
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • libxml2
  • Wiki
  • Thread safety

Thread safety · Changes

Page history
Create Thread safety authored Feb 12, 2022 by Nick Wellnhofer's avatar Nick Wellnhofer
Hide whitespace changes
Inline Side-by-side
Thread-safety.md 0 → 100644
View page @ 7076305e
Starting with 2.4.7, libxml2 makes provisions to ensure that concurrent threads can safely work in parallel parsing different documents. There is however a couple of things to do to ensure it:
* configure the library accordingly using the --with-threads options
* call xmlInitParser() in the "main" thread before using any of the libxml2 API (except possibly selecting a different memory allocator)
Note that the thread safety cannot be ensured for multiple threads sharing the same document, the locking must be done at the application level, libxml exports a basic mutex and reentrant mutexes API in <libxml/threads.h>. The parts of the library checked for thread safety are:
* concurrent loading
* file access resolution
* catalog access
* catalog building
* entities lookup/accesses
* validation
* global variables per-thread override
* memory handling
XPath has been tested for threaded usage on non-modified document for example when using libxslt, but make 100% sure the documents are accessed read-only !
Daniel Veillard
\ No newline at end of file
Clone repository
  • Architecture
  • Catalog support
  • Encodings support
  • Entities
  • FAQ
  • IO interfaces
  • Memory management
  • Namespaces
  • Parser interfaces
  • Python bindings
  • Reader Interface
  • SAX interface
  • Thread safety
  • Tree structure
  • Validation and DTDs
View All Pages