Expand description
Threading support (§57, §93, §85 Phase 1).
Thread-local state, concurrent parsing, concurrent transformation, shared immutable dictionaries, callback isolation.
§UPSTREAM-PARITY
libxml2’s threading support provides:
xmlInitThreads()/xmlCleanupThreads()— lifecyclexmlLockLibrary()/xmlUnlockLibrary()— global lock- Thread-local storage for error state and parser contexts
In modern libxml2 (2.12+), threading is initialized automatically
by xmlInitParser. The explicit thread functions exist for backward
compatibility.
In Rust, we use standard thread-safe primitives and thread_local!
for thread-local storage. The global lock is a no-op since Rust’s
type system prevents data races at compile time.
§Phase 1 status
Complete — all threading support is implemented.
Functions§
- cleanup_
threads - Clean up threading support.
- free_
mutex ⚠ - Free a simple mutex (upstream threads.h
xmlFreeMutex). - free_
rmutex ⚠ - Free a recursive mutex (upstream threads.h
xmlFreeRMutex). - get_
thread_ count - Get the number of active threads (for compatibility).
- init_
threads - Initialize threading support.
- lock_
library - Lock the library (global mutex).
- mutex_
lock ⚠ - Lock a simple mutex (upstream threads.h
xmlMutexLock). - mutex_
unlock ⚠ - Unlock a simple mutex (upstream threads.h
xmlMutexUnlock). - new_
mutex - Create a simple mutex (upstream threads.h
xmlNewMutex). - new_
rmutex - Create a recursive mutex (upstream threads.h
xmlNewRMutex). - rmutex_
lock ⚠ - Lock a recursive mutex (upstream threads.h
xmlRMutexLock). - rmutex_
unlock ⚠ - Unlock a recursive mutex (upstream threads.h
xmlRMutexUnlock). - threads_
initialized - Check whether threading has been initialized.
- unlock_
library - Unlock the library.