You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@apache.org on 2005/06/04 21:49:33 UTC

svn commit: r180016 [1/2] - in /xerces/c/branches/xerces-2.7: Projects/Win32/VC6/xerces-all/XercesLib/ Projects/Win32/VC7.1/xerces-all/XercesLib/ Projects/Win32/VC7/xerces-all/XercesLib/ src/xercesc/dom/deprecated/ src/xercesc/dom/impl/ src/xercesc/framework/ src/xercesc/framework/psvi/ src/xercesc/internal/ src/xercesc/util/ src/xercesc/util/NetAccessors/WinSock/ src/xercesc/util/Platforms/AIX/ src/xercesc/util/Platforms/BeOS/ src/xercesc/util/Platforms/Cygwin/ src/xercesc/util/Platforms/FreeBSD/ src/xercesc/util/Platforms/HPUX/ src/xercesc/util/Platforms/IRIX/ src/xercesc/util/Platforms/Interix/ src/xercesc/util/Platforms/Linux/ src/xercesc/util/Platforms/MacOS/ src/xercesc/util/Platforms/NetBSD/ src/xercesc/util/Platforms/OS2/ src/xercesc/util/Platforms/OS390/ src/xercesc/util/Platforms/OS400/ src/xercesc/util/Platforms/OpenServer/ src/xercesc/util/Platforms/QNX/ src/xercesc/util/Platforms/Solaris/ src/xercesc/util/Platforms/Tandem/ src/xercesc/util/Platforms/Tru64/ src/xercesc/util/Platforms/UnixWare/ src/xercesc/util/Platforms/Win32/ src/xercesc/util/regx/ src/xercesc/validators/DTD/ src/xercesc/validators/datatype/ src/xercesc/validators/schema/

Author: jberry
Date: Sat Jun  4 12:49:30 2005
New Revision: 180016

URL: http://svn.apache.org/viewcvs?rev=180016&view=rev
Log:
Merge 179992:180015 from main trunk.

This is the bertoni patch for Jira issue XERCESC-1420.


Added:
    xerces/c/branches/xerces-2.7/src/xercesc/util/XMLHolder.c
      - copied unchanged from r180015, xerces/c/trunk/src/xercesc/util/XMLHolder.c
    xerces/c/branches/xerces-2.7/src/xercesc/util/XMLHolder.hpp
      - copied unchanged from r180015, xerces/c/trunk/src/xercesc/util/XMLHolder.hpp
Modified:
    xerces/c/branches/xerces-2.7/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
    xerces/c/branches/xerces-2.7/Projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj
    xerces/c/branches/xerces-2.7/Projects/Win32/VC7/xerces-all/XercesLib/XercesLib.vcproj
    xerces/c/branches/xerces-2.7/src/xercesc/dom/deprecated/DOMString.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationImpl.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationRegistry.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNodeImpl.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNormalizer.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/framework/psvi/XSValue.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/internal/XMLScanner.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/EncodingValidator.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Makefile.in
    xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.hpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.hpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Cygwin/CygwinPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Interix/InterixPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.hpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Tandem/TandemPlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/SynchronizedStringPool.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/XMLException.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RangeTokenMap.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RangeTokenMap.hpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegxParser.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegxParser.hpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/DTD/DTDGrammar.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/ComplexTypeInfo.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/GeneralAttributeCheck.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.cpp

Modified: xerces/c/branches/xerces-2.7/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp (original)
+++ xerces/c/branches/xerces-2.7/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp Sat Jun  4 12:49:30 2005
@@ -903,6 +903,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\..\..\src\xercesc\util\XMLMutexHolder.hpp
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\..\..\src\xercesc\util\XMLNetAccessor.hpp
 # End Source File
 # Begin Source File

Modified: xerces/c/branches/xerces-2.7/Projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/Projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/Projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj (original)
+++ xerces/c/branches/xerces-2.7/Projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj Sat Jun  4 12:49:30 2005
@@ -576,6 +576,9 @@
 				RelativePath="..\..\..\..\..\src\xercesc\util\XMLFloat.hpp">
 			</File>
 			<File
+				RelativePath="..\..\..\..\..\src\xercesc\util\XMLHolder.hpp">
+			</File>
+			<File
 				RelativePath="..\..\..\..\..\src\xercesc\util\XMLIBM1047Transcoder.cpp">
 			</File>
 			<File

Modified: xerces/c/branches/xerces-2.7/Projects/Win32/VC7/xerces-all/XercesLib/XercesLib.vcproj
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/Projects/Win32/VC7/xerces-all/XercesLib/XercesLib.vcproj?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/Projects/Win32/VC7/xerces-all/XercesLib/XercesLib.vcproj (original)
+++ xerces/c/branches/xerces-2.7/Projects/Win32/VC7/xerces-all/XercesLib/XercesLib.vcproj Sat Jun  4 12:49:30 2005
@@ -457,7 +457,7 @@
 			</File>
 			<File
 				RelativePath="..\..\..\..\..\src\xercesc\util\XMLInitializer.hpp">
-			</File>			
+			</File>
 			<File
 				RelativePath="..\..\..\..\..\src\xercesc\util\XMLInteger.hpp">
 			</File>
@@ -468,6 +468,9 @@
 				RelativePath="..\..\..\..\..\src\xercesc\util\XMLMsgLoader.hpp">
 			</File>
 			<File
+				RelativePath="..\..\..\..\..\src\xercesc\util\XMLMutexHolder.hpp">
+			</File>
+			<File
 				RelativePath="..\..\..\..\..\src\xercesc\util\XMLNetAccessor.hpp">
 			</File>
 			<File
@@ -1369,16 +1372,16 @@
 				RelativePath="..\..\..\..\..\src\xercesc\parsers\DOMBuilderImpl.hpp">
 			</File>
 			<File
-				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAX2XMLReaderImpl.cpp">
+				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAX2XMLFilterImpl.cpp">
 			</File>
 			<File
-				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAX2XMLReaderImpl.hpp">
+				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAX2XMLFilterImpl.hpp">
 			</File>
 			<File
-				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAX2XMLFilterImpl.cpp">
+				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAX2XMLReaderImpl.cpp">
 			</File>
 			<File
-				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAX2XMLFilterImpl.hpp">
+				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAX2XMLReaderImpl.hpp">
 			</File>
 			<File
 				RelativePath="..\..\..\..\..\src\xercesc\parsers\SAXParser.cpp">
@@ -1976,10 +1979,10 @@
 				RelativePath="..\..\..\..\..\src\xercesc\sax2\DefaultHandler.hpp">
 			</File>
 			<File
-				RelativePath="..\..\..\..\..\src\xercesc\sax2\SAX2XMLReader.hpp">
+				RelativePath="..\..\..\..\..\src\xercesc\sax2\SAX2XMLFilter.hpp">
 			</File>
 			<File
-				RelativePath="..\..\..\..\..\src\xercesc\sax2\SAX2XMLFilter.hpp">
+				RelativePath="..\..\..\..\..\src\xercesc\sax2\SAX2XMLReader.hpp">
 			</File>
 			<File
 				RelativePath="..\..\..\..\..\src\xercesc\sax2\XMLReaderFactory.hpp">

Modified: xerces/c/branches/xerces-2.7/src/xercesc/dom/deprecated/DOMString.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/dom/deprecated/DOMString.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/dom/deprecated/DOMString.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/dom/deprecated/DOMString.cpp Sat Jun  4 12:49:30 2005
@@ -92,7 +92,7 @@
 {
     if (!DOMStringHandleMutex)
     {
-        XMLMutex* tmpMutex = new XMLMutex;
+        XMLMutex* tmpMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
         if (XMLPlatformUtils::compareAndSwap((void**)&DOMStringHandleMutex, tmpMutex, 0))
         {
             // Someone beat us to it, so let's clean up ours

Modified: xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationImpl.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationImpl.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationImpl.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationImpl.cpp Sat Jun  4 12:49:30 2005
@@ -91,7 +91,7 @@
         // If we got here first, then register it and set the registered flag
         if (!sMutex4DOM)
         {
-            sMutex4DOM = new XMLMutex;
+            sMutex4DOM = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
             mutex4DOMCleanup.registerCleanup(reinitMutex4DOM);
         }
     }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationRegistry.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationRegistry.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationRegistry.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMImplementationRegistry.cpp Sat Jun  4 12:49:30 2005
@@ -90,7 +90,7 @@
 
         if (!gDOMImplSrcVectorMutex)
         {
-            gDOMImplSrcVectorMutex = new XMLMutex;
+            gDOMImplSrcVectorMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
             cleanupDOMImplSrcVectorMutex.registerCleanup(reinitDOMImplSrcVectorMutex);
         }
     }
@@ -101,7 +101,7 @@
 void XMLInitializer::initializeDOMImplementationRegistry()
 {
     // mutex
-    gDOMImplSrcVectorMutex = new XMLMutex;
+    gDOMImplSrcVectorMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
     if (gDOMImplSrcVectorMutex) {
         cleanupDOMImplSrcVectorMutex.registerCleanup(reinitDOMImplSrcVectorMutex);
     }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNodeImpl.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNodeImpl.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNodeImpl.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNodeImpl.cpp Sat Jun  4 12:49:30 2005
@@ -134,7 +134,7 @@
             XMLMutexLock lock(XMLPlatformUtils::fgAtomicMutex);
 			
             if (!gEmptyNodeListMutex)
-                gEmptyNodeListMutex = new XMLMutex;
+                gEmptyNodeListMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
         }
 
         // Use a faux scope to synchronize while we do this

Modified: xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNormalizer.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNormalizer.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNormalizer.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMNormalizer.cpp Sat Jun  4 12:49:30 2005
@@ -86,7 +86,7 @@
         // If we got here first, then register it and set the registered flag
         if (!sRegistered)
         {
-            sNormalizerMutex = new XMLMutex;
+            sNormalizerMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
             normalizerMutexCleanup.registerCleanup(DOMNormalizer::reinitNormalizerMutex);
             sRegistered = true;
         }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/framework/XMLValidator.cpp Sat Jun  4 12:49:30 2005
@@ -132,7 +132,7 @@
 
         if (!sMsgMutex)
         {
-            sMsgMutex = new XMLMutex;
+            sMsgMutex = new (XMLPlatformUtils::fgMemoryManager) XMLMutex(XMLPlatformUtils::fgMemoryManager);
             validatorMutexCleanup.registerCleanup(XMLValidator::reinitMsgMutex);
         }
     }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/framework/psvi/XSValue.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/framework/psvi/XSValue.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/framework/psvi/XSValue.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/framework/psvi/XSValue.cpp Sat Jun  4 12:49:30 2005
@@ -234,7 +234,7 @@
 
         if (!sXSValueMutext)
         {
-            sXSValueMutext = new XMLMutex;
+            sXSValueMutext = new (XMLPlatformUtils::fgMemoryManager) XMLMutex(XMLPlatformUtils::fgMemoryManager);
             XSValueRegExCleanup.registerCleanup(XSValue::reinitMutex);
         }
     }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/internal/XMLScanner.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/internal/XMLScanner.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/internal/XMLScanner.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/internal/XMLScanner.cpp Sat Jun  4 12:49:30 2005
@@ -89,7 +89,7 @@
 
         if (!sRegistered)
         {
-            sScannerMutex = new XMLMutex;
+            sScannerMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
             scannerMutexCleanup.registerCleanup(XMLScanner::reinitScannerMutex);
             sRegistered = true;
         }
@@ -127,7 +127,7 @@
         cleanupMsgLoader.registerCleanup(XMLScanner::reinitMsgLoader);
     }
 
-    sScannerMutex = new XMLMutex;
+    sScannerMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
     if (sScannerMutex) {
         scannerMutexCleanup.registerCleanup(XMLScanner::reinitScannerMutex);
         sRegistered = true;

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/EncodingValidator.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/EncodingValidator.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/EncodingValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/EncodingValidator.cpp Sat Jun  4 12:49:30 2005
@@ -78,7 +78,7 @@
         // If we got here first, then register it and set the registered flag
         if (!sEncValMutex)
         {
-            sEncValMutex = new XMLMutex;
+            sEncValMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
             encValRegistryCleanup.registerCleanup(reinitEncValMutex);
         }
     }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Makefile.in
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Makefile.in?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Makefile.in (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Makefile.in Sat Jun  4 12:49:30 2005
@@ -541,6 +541,7 @@
 	XMLInitializer.hpp \
 	XMLInteger.hpp \
 	XMLMsgLoader.hpp \
+	XMLHolder.hpp \
 	XMLNetAccessor.hpp \
 	XMLNumber.hpp \
 	XMLRegisterCleanup.hpp \
@@ -581,6 +582,7 @@
 	ValueStackOf.c \
 	ValueVectorOf.c \
 	XMLDeleterFor.c \
+	XMLHolder.c \
 	LogicalPath.c
 
 UTIL_CPP_OBJECTS = \

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.cpp Sat Jun  4 12:49:30 2005
@@ -59,12 +59,12 @@
 // ---------------------------------------------------------------------------
 //  XMLMutex: Constructors and Destructor
 // ---------------------------------------------------------------------------
-XMLMutex::XMLMutex() :
+XMLMutex::XMLMutex(MemoryManager* const manager) :
 
     fHandle(0)
 {
     // Ask the per-platform driver to make us a mutex
-    fHandle = XMLPlatformUtils::makeMutex();
+    fHandle = XMLPlatformUtils::makeMutex(manager);
 }
 
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.hpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Mutexes.hpp Sat Jun  4 12:49:30 2005
@@ -55,6 +55,7 @@
 #define MUTEXES_HPP
 
 #include <xercesc/util/XMemory.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
 
 XERCES_CPP_NAMESPACE_BEGIN
 
@@ -64,7 +65,7 @@
     // -----------------------------------------------------------------------
     //  Constructors and Destructor
     // -----------------------------------------------------------------------
-    XMLMutex();
+    XMLMutex(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
 
     ~XMLMutex();
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp Sat Jun  4 12:49:30 2005
@@ -276,7 +276,7 @@
     {
         if (!fInitMutex)
         {
-            XMLMutex* tmpMutex = new XMLMutex();
+            XMLMutex* tmpMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
             if (XMLPlatformUtils::compareAndSwap((void**)&fInitMutex, tmpMutex, 0))
             {
                 // Someone beat us to it, so let's clean up ours

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -270,11 +270,11 @@
     platformInit();
 
     // Create the local sync mutex
-    gSyncMutex = new XMLMutex;
+    gSyncMutex = new XMLMutex(fgMemoryManager);
 
 	// Create the mutex for the static data cleanup list
-    gXMLCleanupListMutex = new XMLMutex;
-    fgAtomicMutex = new XMLMutex;
+    gXMLCleanupListMutex = new XMLMutex(fgMemoryManager);
+    fgAtomicMutex = new XMLMutex(fgMemoryManager);
 
     //
     //  Ask the per-platform code to make the desired transcoding service for

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.hpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/PlatformUtils.hpp Sat Jun  4 12:49:30 2005
@@ -537,8 +537,10 @@
       * the actual content of the passed mutex handle is. The returned
       * handle pointer will be eventually passed to closeMutex() which is
       * also implemented by the platform driver.
+      *
+      * @param manager The MemoryManager to use to allocate objects
       */
-    static void* makeMutex();
+    static void* makeMutex(MemoryManager* manager = XMLPlatformUtils::fgMemoryManager);
 
     /** Unlocks a mutex
       *

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -44,6 +44,7 @@
 #include    <xercesc/util/PlatformUtils.hpp>
 #include    <xercesc/util/RuntimeException.hpp>
 #include    <xercesc/util/Janitor.hpp>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/PanicHandler.hpp>
@@ -80,7 +81,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -96,11 +97,11 @@
 XMLTransService* XMLPlatformUtils::makeTransService()
 #if defined (XML_USE_ICU_TRANSCODER)
 {
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 }
 #else
 {
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 }
 #endif
 
@@ -115,11 +116,11 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -361,64 +362,77 @@
 //  Mutex methods
 // -----------------------------------------------------------------------
 #ifndef APP_NO_THREADS
+
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
 void XMLPlatformUtils::closeMutex(void* const mtxHandle)
 {
     if (mtxHandle == NULL)
         return;
-    if (pthread_mutex_destroy( (pthread_mutex_t*)mtxHandle))
+
+    MutexHolderType* const  holder = MutexHolderType::castTo(mtxHandle);
+
+    if (pthread_mutex_destroy(&holder->fInstance))
     {
-        ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
+        delete holder;
+
+        ThrowXMLwithMemMgr(
+            XMLPlatformUtilsException,
+            XMLExcepts::Mutex_CouldNotDestroy,
+            fgMemoryManager);
     }
-    if ( (pthread_mutex_t*)mtxHandle)
-        delete (pthread_mutex_t*) mtxHandle;
+
+    delete holder;
 }
 void XMLPlatformUtils::lockMutex(void* const mtxHandle)
 {
     if (mtxHandle == NULL)
         return;
-    if (pthread_mutex_lock( (pthread_mutex_t*)mtxHandle))
+
+    if (pthread_mutex_lock(&MutexHolderType::castTo(mtxHandle)->fInstance))
     {
         panic(PanicHandler::Panic_MutexErr);
     }
-
 }
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    if (mutex ==  NULL)
-    {
-        panic(PanicHandler::Panic_MutexErr);
-    }
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    pthread_mutexattr_t     attr;
+
 #if defined(XML_USE_DCE)
-    pthread_mutexattr_create(attr);
-    pthread_mutexattr_setkind_np(attr, MUTEX_RECURSIVE_NP);
-    if (pthread_mutex_init(mutex, *attr))
+    pthread_mutexattr_create(&attr);
+    pthread_mutexattr_setkind_np(&attr, MUTEX_RECURSIVE_NP);
+    if (pthread_mutex_init(&holder->fInstance, attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_delete(attr);
+    pthread_mutexattr_delete(&attr);
 #else
-    pthread_mutexattr_init(attr);
+    pthread_mutexattr_init(&attr);
     #if defined(XML_AIX43)
-        pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
+        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
     #else
-        pthread_mutexattr_setkind_np(attr, MUTEX_RECURSIVE_NP);
+        pthread_mutexattr_setkind_np(&attr, MUTEX_RECURSIVE_NP);
     #endif
-    if (pthread_mutex_init(mutex, attr))
+    if (pthread_mutex_init(&holder->fInstance, &attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_destroy(attr);
+    pthread_mutexattr_destroy(&attr);
 #endif
-    delete attr;
-    return (void*)(mutex);
+
+    return holder;
 }
 void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
 {
     if (mtxHandle == NULL)
         return;
-    if (pthread_mutex_unlock( (pthread_mutex_t*)mtxHandle))
+    if (pthread_mutex_unlock(&MutexHolderType::castTo(mtxHandle)->fInstance))
     {
         panic(PanicHandler::Panic_MutexErr);
     }
@@ -426,20 +440,20 @@
 
 #else // #ifndef APP_NO_THREADS
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* const)
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
         return 0;
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -143,7 +143,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -162,12 +162,12 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
         // same as -DXML_USE_INMEM_MESSAGELOADER
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -194,13 +194,13 @@
 #if defined (XML_USE_ICU_TRANSCODER)
     // Use ICU transcoding services.
     // same as -DXML_USE_ICU_MESSAGELOADER
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #elif defined (XML_USE_GNU_TRANSCODER)
-    return new IconvGNUTransService;
+    return new (fgMemoryManager) IconvGNUTransService;
 #else
     // Use native transcoding services.
     // same as -DXML_USE_NATIVE_TRANSCODER
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 
 #endif
 }
@@ -466,25 +466,30 @@
     // mutex creation that must be broken.
     if(!atomicOpsMutex)
     {
-        atomicOpsMutex = new (fgMemoryManager) XMLMutex();
+        atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
         if (atomicOpsMutex->fHandle == 0)
-            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex();
+            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex(fgMemoryManager);
     }
 }
 
-void* XMLPlatformUtils::makeMutex()
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
-    pthread_mutexattr_init(attr);
-    pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE_NP);
-    if (pthread_mutex_init(mutex, attr))
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    pthread_mutexattr_t  attr;
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
+    if (pthread_mutex_init(&holder->fInstance, &attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_destroy(attr);
-    delete attr;
-    return (void*)(mutex);
+    pthread_mutexattr_destroy(&attr);
+
+    return holder
 
 }
 
@@ -492,12 +497,20 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle))
+        MutexHolderType* const  holder =
+            MutexHolderType::castTo(mtxHandle);
+
+        if (pthread_mutex_destroy(&holder->fInstance))
         {
-            ThrowXMLwithMemMgr(XMLPlatformUtilsException,
-                     XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
+            delete holder;
+
+            ThrowXMLwithMemMgr(
+                XMLPlatformUtilsException,
+                XMLExcepts::Mutex_CouldNotDestroy,
+                fgMemoryManager);
         }
-        delete (pthread_mutex_t*) mtxHandle;
+
+        delete holder;
     }
 }
 
@@ -506,7 +519,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_lock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -518,7 +531,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_unlock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -563,20 +576,20 @@
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
         return 0;
 }
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Cygwin/CygwinPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Cygwin/CygwinPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Cygwin/CygwinPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Cygwin/CygwinPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -49,6 +49,7 @@
 #include    <xercesc/util/RuntimeException.hpp>
 #include    <xercesc/util/Janitor.hpp>
 #include    <xercesc/util/Mutexes.hpp>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/XMLUni.hpp>
@@ -93,9 +94,9 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #elif defined (XML_USE_NETACCESSOR_LIBWWW)
-    return new LibWWWNetAccessor();
+    return new (fgMemoryManager) LibWWWNetAccessor();
 #else
     return 0;
 #endif
@@ -114,12 +115,12 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
         // same as -DXML_USE_INMEM_MESSAGELOADER
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -146,15 +147,15 @@
 #if defined (XML_USE_ICU_TRANSCODER)
     // Use ICU transcoding services.
     // same as -DXML_USE_ICU_MESSAGELOADER
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #elif defined (XML_USE_GNU_TRANSCODER)
-    return new IconvGNUTransService;
+    return new (fgMemoryManager) IconvGNUTransService;
 #elif defined (XML_USE_CYGWIN_TRANSCODER)
-    return new CygwinTransService;
+    return new (fgMemoryManager) CygwinTransService;
 #else
     // Use native transcoding services.
     // same as -DXML_USE_NATIVE_TRANSCODER
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 
 #endif
 }
@@ -464,27 +465,33 @@
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+typedef XMLHolder<CRITICAL_SECTION>  MutexHolderType;
+
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-	CRITICAL_SECTION* newCS = new CRITICAL_SECTION;
-	::InitializeCriticalSection(newCS);
-	return newCS;
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    InitializeCriticalSection(&holder->fInstance);
+
+    return holder;
 }
 
 void XMLPlatformUtils::closeMutex(void* const mtxHandle)
 {
-	::DeleteCriticalSection((LPCRITICAL_SECTION)mtxHandle);
-	delete (CRITICAL_SECTION*)mtxHandle;
+    MutexHolderType* const  holder = MutexHolderType::castTo(mtxHandle);
+
+    ::DeleteCriticalSection(&holder->fInstance);
+    delete holder;
 }
 
 void XMLPlatformUtils::lockMutex(void* const mtxHandle)
 {
-	::EnterCriticalSection((LPCRITICAL_SECTION)mtxHandle);
+    ::EnterCriticalSection(&MutexHolderType::castTo(mtxHandle)->fInstance);
 }
 
 void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
 {
-	::LeaveCriticalSection((LPCRITICAL_SECTION)mtxHandle);
+    ::LeaveCriticalSection(&MutexHolderType::castTo(mtxHandle)->fInstance);
 }
 
 void* XMLPlatformUtils::compareAndSwap (void**             toFill,
@@ -522,20 +529,20 @@
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
 	return 0;
 }
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -127,6 +127,7 @@
 #include    <xercesc/util/RuntimeException.hpp>
 #include    <xercesc/util/Janitor.hpp>
 #include    <xercesc/util/Mutexes.hpp>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/XMLUni.hpp>
@@ -164,7 +165,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -183,12 +184,12 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);        
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);        
 #else
         // same as -DXML_USE_INMEM_MESSAGELOADER
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -215,11 +216,11 @@
 #if defined (XML_USE_ICU_TRANSCODER)
     // Use ICU transcoding services.
     // same as -DXML_USE_ICU_MESSAGELOADER
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #else
     // Use native transcoding services.
     // same as -DXML_USE_INMEM_MESSAGELOADER
-    return new IconvFBSDTransService;
+    return new (fgMemoryManager) IconvFBSDTransService;
 
 #endif
 }
@@ -512,38 +513,48 @@
     // mutex creation that must be broken.
     if(!atomicOpsMutex)
     {
-        atomicOpsMutex = new (fgMemoryManager) XMLMutex();
+        atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
         if (atomicOpsMutex->fHandle == 0)
-            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex();
+            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex(fgMemoryManager);
     }
 }
 
-void* XMLPlatformUtils::makeMutex()
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
-    pthread_mutexattr_init(attr);
-    pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
-    if (pthread_mutex_init(mutex, attr))
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    pthread_mutexattr_t  attr;
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+
+    if (pthread_mutex_init(&holder->fInstance, &attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_destroy(attr);
-    delete attr;
-    return (void*)(mutex);
+    pthread_mutexattr_destroy(&attr);
 
+    return holder;
 }
 
 void XMLPlatformUtils::closeMutex(void* const mtxHandle)
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle))
+        MutexHolderType* const  holder =
+            MutexHolderType::castTo(mtxHandle);
+
+        if (pthread_mutex_destroy(&holder->fInstance))
         {
+            delete holder;
+
             ThrowXMLwithMemMgr(XMLPlatformUtilsException,
                      XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
         }
-        delete (pthread_mutex_t*)mtxHandle;
+        delete holder;
     }
 }
 
@@ -552,7 +563,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_lock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -564,7 +575,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_unlock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -609,7 +620,7 @@
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
         return 0;
 }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -163,6 +163,7 @@
 #include    <xercesc/util/PlatformUtils.hpp>
 #include    <xercesc/util/RuntimeException.hpp>
 #include    <xercesc/util/Janitor.hpp>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/Mutexes.hpp>
 #include    <dl.h>
 #include    <stdio.h>
@@ -223,7 +224,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -242,12 +243,12 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
         // same as -DXML_USE_INMEM_MESSAGELOADER
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -272,12 +273,12 @@
 {
 
 #if defined (XML_USE_ICU_TRANSCODER)
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #else
 
     // Use native transcoding services.
     // same as -DXML_USE_INMEM_MESSAGELOADER
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 
 #endif
 
@@ -541,6 +542,8 @@
 // ---------------------------------------------------------------------------
 //  XMLPlatformUtils: Platform init method
 // ---------------------------------------------------------------------------
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
 static XMLMutex *atomicOpsMutex = 0;
 
 void XMLPlatformUtils::platformInit()
@@ -552,48 +555,56 @@
     // mutex creation that must be broken.
     if(!atomicOpsMutex)
     {
-        atomicOpsMutex = new (fgMemoryManager) XMLMutex();
-        if (atomicOpsMutex->fHandle == 0)
-            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex();
+        atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
     }
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    pthread_mutexattr_t     attr;
 
 #if defined(XML_USE_DCE)
-    pthread_mutexattr_create(attr);
-    pthread_mutexattr_setkind_np(attr, MUTEX_RECURSIVE_NP);
-    if (pthread_mutex_init(mutex, *attr))
+    pthread_mutexattr_create(&attr);
+    pthread_mutexattr_setkind_np(&attr, MUTEX_RECURSIVE_NP);
+    if (pthread_mutex_init(&holder->fInstance, attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_delete(attr);
+    pthread_mutexattr_delete(&attr);
 #else
-    pthread_mutexattr_init(attr);
-    pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
-    if (pthread_mutex_init(mutex, attr))
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+    if (pthread_mutex_init(&holder->fInstance, &attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_destroy(attr);
+    pthread_mutexattr_destroy(&attr);
 #endif
-    delete attr;
 
-    return (void*) mutex;
+    return holder;
 }
 
 void XMLPlatformUtils::closeMutex(void* const mtxHandle)
 {
-    pthread_mutex_t* mutex = (pthread_mutex_t *) mtxHandle;
-    if (mutex != NULL)
+    if (mtxHandle != NULL)
     {
-        if (pthread_mutex_destroy(mutex))
+        MutexHolderType* const  holder = MutexHolderType::castTo(mtxHandle);
+
+        if (pthread_mutex_destroy(&holder->fInstance))
+        {
+            delete holder;
+
             ThrowXMLwithMemMgr(XMLPlatformUtilsException,
                   XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
-        delete mutex;
+        }
+
+        delete holder;
     }
 }
 
@@ -601,7 +612,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_lock((pthread_mutex_t *) mtxHandle))
+        if (pthread_mutex_lock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -612,7 +623,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_unlock((pthread_mutex_t *) mtxHandle))
+        if (pthread_mutex_unlock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -657,20 +668,20 @@
 {
 }
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* const)
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
     return 0;
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -158,6 +158,7 @@
 #include    <xercesc/util/RuntimeException.hpp>
 #include    <xercesc/util/Janitor.hpp>
 #include    <xercesc/util/Mutexes.hpp>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/XMLUni.hpp>
@@ -195,7 +196,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -212,12 +213,12 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
         // same as -DXML_USE_INMEM_MESSAGELOADER
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -244,11 +245,11 @@
 #if defined (XML_USE_ICU_TRANSCODER)
     // Use ICU transcoding services.
     // same as -DXML_USE_ICU_MESSAGELOADER
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #else
     // Use native transcoding services.
     // same as -DXML_USE_INMEM_MESSAGELOADER
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 
 #endif
 }
@@ -535,9 +536,9 @@
 
     if(!atomicOpsMutex)
     {
-        atomicOpsMutex = new (fgMemoryManager) XMLMutex();
+        atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
         if (atomicOpsMutex->fHandle == 0)
-            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex();
+            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex(fgMemoryManager);
     }
 }
 
@@ -558,7 +559,7 @@
 }
 
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
     if (arena) {
         usema_t* sema = usnewsema (arena, 1);
@@ -627,9 +628,9 @@
     // mutex creation that must be broken.
     if(!atomicOpsMutex)
     {
-        atomicOpsMutex = new (fgMemoryManager) XMLMutex();
+        atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
         if (atomicOpsMutex->fHandle == 0)
-            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex();
+            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex(fgMemoryManager);
     }
 }
 
@@ -642,32 +643,41 @@
     atomicOpsMutex = 0;
 }
 
-void* XMLPlatformUtils::makeMutex()
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
-    pthread_mutexattr_init(attr);
-    pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
-    if (pthread_mutex_init(mutex, attr))
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    pthread_mutexattr_t  attr;
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+    if (pthread_mutex_init(&holder->fInstance, &attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_destroy(attr);
-    delete attr;
-    return (void*)(mutex);
+    pthread_mutexattr_destroy(&attr);
 
+    return holder;
 }
 
 void XMLPlatformUtils::closeMutex(void* const mtxHandle)
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle))
+        MutexHolderType* const  holder =
+            MutexHolderType::castTo(mtxHandle);
+
+        if (pthread_mutex_destroy(&holder->fInstance))
         {
+            delete holder;
+
             ThrowXMLwithMemMgr(XMLPlatformUtilsException,
                      XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
         }
-        delete (pthread_mutex_t*) mtxHandle;
+        delete holder;
     }
 }
 
@@ -676,7 +686,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_lock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -688,7 +698,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_unlock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Interix/InterixPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Interix/InterixPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Interix/InterixPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Interix/InterixPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -54,6 +54,7 @@
 #include    <xercesc/util/RuntimeException.hpp>
 #include    <xercesc/util/Janitor.hpp>
 #include    <xercesc/util/Mutexes.hpp>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/XMLUni.hpp>
@@ -94,7 +95,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -113,12 +114,12 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
         // same as -DXML_USE_INMEM_MESSAGELOADER
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -145,13 +146,13 @@
 #if defined (XML_USE_ICU_TRANSCODER)
     // Use ICU transcoding services.
     // same as -DXML_USE_ICU_MESSAGELOADER
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #elif defined (XML_USE_GNU_TRANSCODER)
-    return new IconvGNUTransService;
+    return new (fgMemoryManager) IconvGNUTransService;
 #else
     // Use native transcoding services.
     // same as -DXML_USE_NATIVE_TRANSCODER
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 
 #endif
 }
@@ -417,38 +418,47 @@
     // mutex creation that must be broken.
     if ( atomicOpsMutex == 0 )
     {
-	    atomicOpsMutex = new (fgMemoryManager) XMLMutex;
+	    atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
 	    if (atomicOpsMutex->fHandle == 0)
-	        atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex();
+	        atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex(fgMemoryManager);
     }
 }
 
-void* XMLPlatformUtils::makeMutex()
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
-    pthread_mutexattr_init(attr);
-    pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
-    if (pthread_mutex_init(mutex, attr))
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    pthread_mutexattr_t  attr;
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+    if (pthread_mutex_init(&holder->fInstance, &attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_destroy(attr);
-    delete attr;
-    return (void*)(mutex);
+    pthread_mutexattr_destroy(&attr);
 
+    return holder;
 }
 
 void XMLPlatformUtils::closeMutex(void* const mtxHandle)
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle))
+        MutexHolderType* const  holder =
+            MutexHolderType::castTo(mtxHandle);
+
+        if (pthread_mutex_destroy(&holder->fInstance))
         {
+            delete holder;
+
             ThrowXMLwithMemMgr(XMLPlatformUtilsException,
                      XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
         }
-        delete (pthread_mutex_t*) mtxHandle;
+        delete holder;
     }
 }
 
@@ -457,7 +467,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_lock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -469,7 +479,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_unlock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -514,20 +524,20 @@
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
         return 0;
 }
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -205,6 +205,7 @@
 #include    <xercesc/util/RuntimeException.hpp>
 #include    <xercesc/util/Janitor.hpp>
 #include    <xercesc/util/Mutexes.hpp>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/XMLUni.hpp>
@@ -247,9 +248,9 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #elif defined (XML_USE_NETACCESSOR_LIBWWW)
-    return new LibWWWNetAccessor();
+    return new (fgMemoryManager) LibWWWNetAccessor();
 #else
     return 0;
 #endif
@@ -268,12 +269,12 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
         // same as -DXML_USE_INMEM_MESSAGELOADER
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -300,13 +301,13 @@
 #if defined (XML_USE_ICU_TRANSCODER)
     // Use ICU transcoding services.
     // same as -DXML_USE_ICU_MESSAGELOADER
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #elif defined (XML_USE_GNU_TRANSCODER)
-    return new IconvGNUTransService;
+    return new (fgMemoryManager) IconvGNUTransService;
 #else
     // Use native transcoding services.
     // same as -DXML_USE_NATIVE_TRANSCODER
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 
 #endif
 }
@@ -572,38 +573,48 @@
     // mutex creation that must be broken.
     if ( atomicOpsMutex == 0 )
     {
-	    atomicOpsMutex = new (fgMemoryManager) XMLMutex;
+	    atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
 	    if (atomicOpsMutex->fHandle == 0)
-	        atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex();
+	        atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex(fgMemoryManager);
     }
 }
 
-void* XMLPlatformUtils::makeMutex()
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
-    pthread_mutexattr_init(attr);
-    pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE_NP);
-    if (pthread_mutex_init(mutex, attr))
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    pthread_mutexattr_t  attr;
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
+
+    if (pthread_mutex_init(&holder->fInstance, &attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_destroy(attr);
-    delete attr;
-    return (void*)(mutex);
+    pthread_mutexattr_destroy(&attr);
 
+    return holder;
 }
 
 void XMLPlatformUtils::closeMutex(void* const mtxHandle)
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle))
+        MutexHolderType* const  holder =
+            MutexHolderType::castTo(mtxHandle);
+
+        if (pthread_mutex_destroy(&holder->fInstance))
         {
+            delete holder;
+
             ThrowXMLwithMemMgr(XMLPlatformUtilsException,
                      XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
         }
-        delete (pthread_mutex_t*) mtxHandle;
+        delete holder;
     }
 }
 
@@ -612,7 +623,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_lock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -624,7 +635,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_unlock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -669,20 +680,20 @@
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
         return 0;
 }
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -201,7 +201,7 @@
     if (!gFileSystemCompatible)
         ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, fileName, manager);
 
-    Janitor<XMLMacAbstractFile> file(XMLMakeMacFile());
+    Janitor<XMLMacAbstractFile> file(XMLMakeMacFile(manager));
     
     return (file->open(fileName, false)) ? file.release() : NULL;
 }
@@ -214,7 +214,7 @@
     if (!gFileSystemCompatible)
         ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, fileName, manager);
 
-    Janitor<XMLMacAbstractFile> file(XMLMakeMacFile());
+    Janitor<XMLMacAbstractFile> file(XMLMakeMacFile(manager));
 
     return (file->open(fileName, false)) ? file.release() : NULL;
 }
@@ -390,7 +390,7 @@
 // ---------------------------------------------------------------------------
 
 void*
-XMLPlatformUtils::makeMutex()
+XMLPlatformUtils::makeMutex(MemoryManager*)
 {
 	if (gHasMPAPIs)
 	{
@@ -586,13 +586,13 @@
 
 #if (defined(USE_URLACCESSCF))
     //	Use the URLAccess code that relies only on CoreFoundation
-	return new MacOSURLAccessCF;
+	return new (fgMemoryManager) MacOSURLAccessCF;
 #elif (defined(USE_URLACCESS))
 	//	Only try to use URLAccess if it's actually available
 	if (URLAccessAvailable())
-		return new MacOSURLAccess;
+		return new (fgMemoryManager) MacOSURLAccess;
 #elif (defined(XML_USE_NETACCESSOR_SOCKET))
-	return new SocketNetAccessor;
+	return new (fgMemoryManager) SocketNetAccessor;
 #endif
 
 	//	No netaccessor available--we can live with it, but you won't
@@ -609,7 +609,7 @@
 XMLPlatformUtils::loadAMsgSet(const XMLCh* const msgDomain)
 {
 #if (defined(XML_USE_INMEMORY_MSGLOADER) || defined(XML_USE_INMEM_MESSAGELOADER))
-    return new InMemMsgLoader(msgDomain);
+    return new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #else
     #error You must provide a message loader
     return 0;
@@ -627,10 +627,10 @@
 XMLPlatformUtils::makeTransService()
 {
 #if defined (XML_USE_ICU_TRANSCODER)
-	return new ICUTransService;
+	return new (fgMemoryManager) ICUTransService;
 #elif (defined(XML_USE_MACOS_UNICODECONVERTER) || defined(XML_USE_NATIVE_TRANSCODER))
     if (MacOSUnicodeConverter::IsMacOSUnicodeConverterSupported())
-        return new MacOSUnicodeConverter;
+        return new (fgMemoryManager) MacOSUnicodeConverter;
 #else
     #error You must provide a transcoding service implementation
 #endif
@@ -735,14 +735,14 @@
 //	Factory method to make an appropriate subclass of XMLMacAbstractFile
 //	for our use
 XMLMacAbstractFile*
-XMLMakeMacFile(void)
+XMLMakeMacFile(MemoryManager* manager)
 {
 	XMLMacAbstractFile* result = NULL;
 	
 	if (gUsePosixFiles)
-		result = new XMLMacPosixFile;
+		result = new (manager) XMLMacPosixFile;
 	else
-		result = new XMLMacCarbonFile;
+		result = new (manager) XMLMacCarbonFile;
 		
 	return result;
 }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.hpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.hpp Sat Jun  4 12:49:30 2005
@@ -53,7 +53,7 @@
 
 //	Factory method to create an appropriate concrete object
 //	descended from XMLMacAbstractFile.
-XMLUTIL_EXPORT XMLMacAbstractFile* XMLMakeMacFile(void);
+XMLUTIL_EXPORT XMLMacAbstractFile* XMLMakeMacFile(MemoryManager* manager);
 
 //	Convert fom FSRef/FSSpec to a Unicode character string path.
 //	Note that you'll need to delete [] that string after you're done with it!

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -45,6 +45,7 @@
 #include    <xercesc/util/RuntimeException.hpp>
 #include    <xercesc/util/Janitor.hpp>
 #include    <xercesc/util/Mutexes.hpp>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/XMLUni.hpp>
@@ -111,7 +112,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -132,10 +133,10 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #else
         // same as -DXML_USE_INMEM_MESSAGELOADER
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -162,11 +163,11 @@
 #if defined (XML_USE_ICU_TRANSCODER)
     // Use ICU transcoding services.
     // same as -DXML_USE_ICU_MESSAGELOADER
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #else
     // Use native transcoding services.
     // same as -DXML_USE_INMEM_MESSAGELOADER
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 
 #endif
 }
@@ -480,25 +481,30 @@
 
     if(!atomicOpsMutex)
     {
-        atomicOpsMutex = new (fgMemoryManager) XMLMutex();
+        atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
         if (atomicOpsMutex->fHandle == 0)
-            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex();
+            atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex(fgMemoryManager);
     }
 }
 
-void* XMLPlatformUtils::makeMutex()
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
-    pthread_mutexattr_init(attr);
+    MutexHolderType* const  holder = new (manager) MutexHolderType;
+
+    pthread_mutexattr_t  attr;
+    pthread_mutexattr_init(&attr);
     pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
     if (pthread_mutex_init(mutex, attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
     pthread_mutexattr_destroy(attr);
-    delete attr;
-    return (void*)(mutex);
+
+    return holder;
 
 }
 
@@ -506,12 +512,17 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle))
+        MutexHolderType* const  holder =
+            MutexHolderType::castTo(mtxHandle);
+
+        if (pthread_mutex_destroy(&holder->fInstance))
         {
+            delete holder;
+
             ThrowXMLwithMemMgr(XMLPlatformUtilsException,
                      XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
         }
-        delete (pthread_mutex_t*)mtxHandle;
+        delete holder;
     }
 }
 
@@ -520,7 +531,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_lock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -532,7 +543,7 @@
 {
     if (mtxHandle != NULL)
     {
-        if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle))
+        if (pthread_mutex_unlock(&MutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -577,20 +588,20 @@
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
         return 0;
 }
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -267,7 +267,7 @@
 #endif
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
 #if ! defined(APP_NO_THREADS)
     HMTX hRet; // Mutex Handle
@@ -378,7 +378,7 @@
 XMLMsgLoader* XMLPlatformUtils::loadAMsgSet(const XMLCh* const msgDomain)
 {
 #if defined(XML_USE_INMEMORY_MSGLOADER)
-    return new InMemMsgLoader(msgDomain);
+    return new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #else
     return 0;
 #endif
@@ -392,9 +392,9 @@
 XMLTransService* XMLPlatformUtils::makeTransService()
 {
 #if defined(XML_USE_ICU_TRANSCODER)
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 #elif defined(XML_USE_ICONV_TRANSCODER)
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 #else
     return 0;
 #endif

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -45,6 +45,7 @@
 #include    <string.h>
 #include    <unistd.h>
 #include    <limits.h>
+#include    <xercesc/util/XMLHolder.hpp>
 #include    <xercesc/util/XMLString.hpp>
 #include    <xercesc/util/XMLUniDefs.hpp>
 #include    <xercesc/util/XMLUni.hpp>
@@ -140,7 +141,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -157,11 +158,11 @@
     try
     {
 #if defined (XML_USE_ICU_MESSAGELOADER)
-        retVal = new ICUMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
-        retVal = new InMemMsgLoader(msgDomain);
+        retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -185,16 +186,16 @@
 #if defined (XML_USE_ICU_TRANSCODER)
 {
 
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 }
 #elif defined (XML_USE_UNICONV390_TRANSCODER)
 {
 
-    return new Uniconv390TransService;
+    return new (fgMemoryManager) Uniconv390TransService;
 }
 #else
 {
-    return new Iconv390TransService;
+    return new (fgMemoryManager) Iconv390TransService;
 }
 #endif
 
@@ -957,21 +958,25 @@
 //  locking mechanism is developed
 // -----------------------------------------------------------------------
 #ifndef APP_NO_THREADS
+typedef XMLHolder<pthread_mutex_t  PThreadMutexHolderType;
+typedef XMLHolder<int>             IntMutexHolderType;
+
 void XMLPlatformUtils::closeMutex(void* const mtxHandle)
 {
     if (mtxHandle == NULL)
         return;
     if (isPosixEnabled) {
-        if (pthread_mutex_destroy( (pthread_mutex_t*)mtxHandle))
+        PThreadMutexHolderType* const  holder = PThreadMutexHolderType::castTo(mtxHandle);
+        if (pthread_mutex_destroy(&holder->fInstance))
         {
+            delete holder;
+ 
             ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotDestroy, fgMemoryManager);
         }
-        if ( (pthread_mutex_t*)mtxHandle)
-            delete (pthread_mutex_t*) mtxHandle;
+        delete holder;
     } // __isPosixOn
     else {
-        if ( (int*)mtxHandle)
-            delete (int*) mtxHandle;
+        delete IntMutexHolderType::castTo(mtxHandle);
     }
 }
 void XMLPlatformUtils::lockMutex(void* const mtxHandle)
@@ -979,7 +984,7 @@
     if (mtxHandle == NULL)
         return;
     if (isPosixEnabled) {
-        if (pthread_mutex_lock( (pthread_mutex_t*)mtxHandle))
+        if (pthread_mutex_lock(&PThreadMutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
@@ -987,40 +992,42 @@
     else {
         int locked = 1, unlocked;
 
+        int*    mutex =
+            &IntMutexHolderType::castTo(mtxHandle)->fInstance;
+
         do {
             unlocked = 0;
-            compareAndSwap( (void**) &mtxHandle, (void*) locked, (void*) unlocked );
+            compareAndSwap( (void**) &mutex, (void*) locked, (void*) unlocked );
         } while( unlocked != 0 );
     }
     return;
 
 }
-void* XMLPlatformUtils::makeMutex()
+
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
     if (isPosixEnabled) {
-    pthread_mutex_t* mutex = new pthread_mutex_t;
-    if (mutex == NULL)
-    {
-        panic(PanicHandler::Panic_MutexErr);
-    }
+    PThreadMutexHolderType* const  holder = new (manager) PThreadMutexHolderType;
 
-    pthread_mutexattr_t*  attr = new pthread_mutexattr_t;
-    pthread_mutexattr_init(attr);
-    pthread_mutexattr_setkind_np(attr, __MUTEX_RECURSIVE);
-    if (pthread_mutex_init(mutex, attr))
+    pthread_mutexattr_t  attr;
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_setkind_np(&attr, __MUTEX_RECURSIVE);
+    if (pthread_mutex_init(&holder->fInstance, &attr))
     {
+        delete holder;
+
         panic(PanicHandler::Panic_MutexErr);
     }
-    pthread_mutexattr_destroy(attr);
-    delete attr;
+    pthread_mutexattr_destroy(&attr);
 
-    return (void*)(mutex);
+    return holder;
 
     } // __isPosixOn
-    else {
-   int* mutex = new int;
-   *mutex = 0;
-   return (void*)(mutex);
+    else
+    {
+        IntMutexHolderType* holder = new (manager) IntMutexHolderType;
+        holder->fInstance = 0;
+        return holder;
     }
 }
 void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
@@ -1028,33 +1035,36 @@
     if (mtxHandle == NULL)
         return;
     if (isPosixEnabled) {
-        if (pthread_mutex_unlock( (pthread_mutex_t*)mtxHandle))
+        if (pthread_mutex_unlock(&PThreadMutexHolderType::castTo(mtxHandle)->fInstance))
         {
             panic(PanicHandler::Panic_MutexErr);
         }
     } // __isPosixOn
     else {
-        if (*(int*) mtxHandle == 0 )
-            *(int*) mtxHandle = 0;
+        int&    mutex =
+            IntMutexHolderType::castTo(mtxHandle)->fInstance;
+
+        if (mutex == 0)
+            mutex = 0;
     }
 }
 
 #else // #ifndef APP_NO_THREADS
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* const)
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
         return 0;
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp?rev=180016&r1=180015&r2=180016&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp Sat Jun  4 12:49:30 2005
@@ -82,7 +82,7 @@
 XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
 {
 #if defined (XML_USE_NETACCESSOR_SOCKET)
-    return new SocketNetAccessor();
+    return new (fgMemoryManager) SocketNetAccessor();
 #else
     return 0;
 #endif
@@ -100,15 +100,15 @@
 XMLTransService* XMLPlatformUtils::makeTransService()
 #if defined (XML_USE_ICU_TRANSCODER)
 {
-    return new ICUTransService;
+    return new (fgMemoryManager) ICUTransService;
 }
 #elif defined (XML_USE_ICONV400_TRANSCODER)
 {
-    return new Iconv400TransService;
+    return new (fgMemoryManager) Iconv400TransService;
 }
 #else
 {
-    return new IconvTransService;
+    return new (fgMemoryManager) IconvTransService;
 }
 #endif
 
@@ -123,13 +123,13 @@
     try
     {
 #if defined(XML_USE_MSGFILE_MESSAGELOADER)        
-        retVal = new MsgCatalogLoader(msgDomain);
+        retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #elif defined (XML_USE_ICU_MESSAGELOADER)
-	retVal = new ICUMsgLoader(msgDomain);
+	retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
 #elif defined (XML_USE_ICONV_MESSAGELOADER)
-	retVal = new MsgCatalogLoader(msgDomain);
+	retVal = new (fgMemoryManager) MsgCatalogLoader(msgDomain);
 #else
-	retVal = new InMemMsgLoader(msgDomain);
+	retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
 #endif
     }
     catch(const OutOfMemoryException&)
@@ -683,7 +683,11 @@
 // -----------------------------------------------------------------------
 
 #if !defined (APP_NO_THREADS)
-static pthread_mutex_t* gAtomicOpMutex =0 ;
+
+typedef XMLHolder<pthread_mutex_t>  MutexHolderType;
+
+static MutexHolderType* gAtomicOpMutex = 0;
+
 void XMLPlatformUtils::platformInit()
 {
     //
@@ -694,12 +698,11 @@
     // circular dependency between compareAndExchange() and
     // mutex creation that must be broken.
 
-    gAtomicOpMutex = new pthread_mutex_t;	
+    gAtomicOpMutex = new (fgMemoryManager) MutexHolderType;
 
-    if (pthread_mutex_init(gAtomicOpMutex, NULL)) {
+    if (pthread_mutex_init(&gAtomicOpMutex->fInstance, NULL)) {
 		delete gAtomicOpMutex;
 		gAtomicOpMutex = 0;
-
         panic( PanicHandler::Panic_SystemInit );
 	}
 }
@@ -710,8 +713,11 @@
     pthread_mutex_t   mutex;
     int               recursionCount;
     pthread_t         tid;
+    MemoryManager*    fManager;
 
-    RecursiveMutex() {
+    RecursiveMutex(MemoryManager* manager) :
+        fManager(manager)
+    {
 		       if (pthread_mutex_init(&mutex, NULL))
 			    XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr);
                        recursionCount = 0;
@@ -722,7 +728,7 @@
 
     ~RecursiveMutex() {
 			if (pthread_mutex_destroy(&mutex))
-			    ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotDestroy, XMLPlatformUtils::fgMemoryManager);
+			    ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotDestroy, manager);
                       }
 
      void lock()      {
@@ -750,9 +756,9 @@
                        }
    };
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager* manager)
 {
-    return new RecursiveMutex;
+    return new (manager) RecursiveMutex(manager);
 }
 
 
@@ -795,14 +801,14 @@
     // the below calls are temporarily made till the above functions are part of user library
     // Currently its supported only in the kernel mode
 
-    if (pthread_mutex_lock( gAtomicOpMutex))
+    if (pthread_mutex_lock( &gAtomicOpMutex->fInstance))
         panic(PanicHandler::Panic_SynchronizationErr);
 
     void *retVal = *toFill;
     if (*toFill == toCompare)
               *toFill = (void *)newValue;
 
-    if (pthread_mutex_unlock( gAtomicOpMutex))
+    if (pthread_mutex_unlock( &gAtomicOpMutex->fInstance))
         panic(PanicHandler::Panic_SynchronizationErr);
 
     return retVal;
@@ -844,20 +850,20 @@
    // do nothing
 }
 
-void XMLPlatformUtils::closeMutex(void* const mtxHandle)
+void XMLPlatformUtils::closeMutex(void* const)
 {
 }
 
-void XMLPlatformUtils::lockMutex(void* const mtxHandle)
+void XMLPlatformUtils::lockMutex(void* constmanager)
 {
 }
 
-void* XMLPlatformUtils::makeMutex()
+void* XMLPlatformUtils::makeMutex(MemoryManager*)
 {
         return 0;
 }
 
-void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
+void XMLPlatformUtils::unlockMutex(void* const)
 {
 }
 
@@ -903,7 +909,7 @@
 void XMLPlatformUtils::platformTerm()
 {
 #if !defined (APP_NO_THREADS)
-	pthread_mutex_destroy(gAtomicOpMutex);
+	pthread_mutex_destroy(&gAtomicOpMutex->fInstance);
     delete gAtomicOpMutex;
 	gAtomicOpMutex = 0;
 #endif



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org