Changeset 8020 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Apr 16, 2008 10:14:39 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r7387 r8020 21 21 #include <iprt/err.h> 22 22 #include <iprt/file.h> 23 #include <iprt/lock.h> 23 24 24 25 #include <libxml/tree.h> … … 74 75 { 75 76 xmlExternalEntityLoader defaultEntityLoader; 77 78 /** Used to provide some thread safety missing in libxml2 (see e.g. 79 * XmlTreeBackend::read()) */ 80 RTLockMtx lock; 76 81 } 77 82 xml; … … 382 387 } 383 388 384 File::File (Mode aMode, RTFILE aHandle, const char *aFileName /* = NULL */ ) 389 #if 0 390 /// @todo disabled until made thread-safe by using handle duplicates 391 File::File (Mode aMode, RTFILE aHandle, const char *aFileName) 385 392 : m (new Data()) 386 393 { … … 400 407 setPos (0); 401 408 } 409 #endif 402 410 403 411 File::~File() … … 903 911 m->trappedErr.reset(); 904 912 905 /* Set up the external entity resolver. Note that we do it in a 906 * thread-unsafe fashion because this stuff is not thread-safe in libxml2. 907 * Making it thread-safe would require a) guarding this method with a 908 * mutex and b) requiring our API caller not to use libxml2 on some other 909 * thread (which is not practically possible). So, our API is not 910 * thread-safe for now (note that there are more thread-unsafe assumptions 911 * below like xsltGenericError which is also a libxslt limitation).*/ 913 /* We use the global lock for the whole duration of this method to serialize 914 * access to thread-unsafe xmlGetExternalEntityLoader() and some other 915 * calls. It means that only one thread is able to parse an XML stream at a 916 * time but another choice would be to patch libxml2/libxslt which is 917 * unwanted now for several reasons. Search for "thread-safe" to find all 918 * unsafe cases. */ 919 RTLock alock (gGlobal.xml.lock); 920 912 921 xmlExternalEntityLoader oldEntityLoader = xmlGetExternalEntityLoader(); 913 922 sThat = this;
Note:
See TracChangeset
for help on using the changeset viewer.