mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2026-01-26 21:41:34 +03:00
xmlschemastypes: ensure thread safe global initialization
Relying on a plain integer flag, with no synchronization primitives does not give thread-safe initialization. All reads & writes of the xmlSchemaTypesInitialized flag need to be protected by a mutex to ensure suitable memory barriers & thus correct ordering wrt any speculative execution. A separate internal initializer tied to xmlParserInit is used to create the mutex used for synchronization, similarly to how catalog.c works. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -58,4 +58,12 @@ xmlInitRMutex(xmlRMutex *mutex);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupRMutex(xmlRMutex *mutex);
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
XML_HIDDEN void
|
||||
xmlInitSchemasTypesInternal(void);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupSchemasTypesInternal(void);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* XML_THREADS_H_PRIVATE__ */
|
||||
|
||||
Reference in New Issue
Block a user