[libxml2.wiki] Create Thread safety
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2.wiki] Create Thread safety
- Date: Sat, 12 Feb 2022 18:15:29 +0000 (UTC)
commit 7076305e6a25e9a0f9f10b9328a3764b4c029b0e
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Sat Feb 12 18:15:28 2022 +0000
Create Thread safety
Thread-safety.md | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/Thread-safety.md b/Thread-safety.md
new file mode 100644
index 0000000..ee2ece7
--- /dev/null
+++ b/Thread-safety.md
@@ -0,0 +1,19 @@
+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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]