tng 2002/09/18 08:22:48 Modified: c/src/xercesc/util/Platforms/OS390 OS390PlatformUtils.cpp Log: OS390 Performance Enhancement: instead of calling isPosixOn everytime, store the information in a static flag during initialization. Patch from Stephen Dulin. Revision Changes Path 1.4 +41 -5 xml-xerces/c/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp Index: OS390PlatformUtils.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- OS390PlatformUtils.cpp 8 Aug 2002 16:40:35 -0000 1.3 +++ OS390PlatformUtils.cpp 18 Sep 2002 15:22:48 -0000 1.4 @@ -106,6 +106,10 @@ #include <xercesc/util/NetAccessors/Socket/SocketNetAccessor.hpp> #endif +// --------------------------------------------------------------------------- +// Static data +// --------------------------------------------------------------------------- +static bool isPosixEnabled = false; // --------------------------------------------------------------------------- // XMLPlatformUtils: Platform init method @@ -116,8 +120,40 @@ // The next conditional section is to turn on support for allowing // the NEL character as a valid whitespace character. Once this is // enabled the parser is non-compliant with the XML standard. +// Assumption: Once this is enabled, it cannot be reset and +// should remain the same during the same process. #if defined XML_ALLOW_NELWS + try + { XMLPlatformUtils::recognizeNEL(true); + } + catch (...) + { + panic(XMLPlatformUtils::Panic_SystemInit); + } +#endif + +// The next section checks if Posix is enabled on the OS/390 system. +// It stores the result in the static isPosixEnabled flag. +// The __isPosixOn() native routine uses too much +// overhead to call repeatedly at runtime so this will be the only +// remaining call of it. +// Assumption: Once this is enabled, it cannot be reset and +// should remain the same during the same process. + +#ifdef OS390BATCH + try + { + if (__isPosixOn()) + { + if (!isPosixEnabled) + isPosixEnabled = true; + } + } + catch (...) + { + panic(XMLPlatformUtils::Panic_SystemInit); + } #endif } @@ -811,7 +847,7 @@ if (mtxHandle == NULL) return; #ifdef OS390BATCH - if (__isPosixOn()) { + if (isPosixEnabled) { #endif if (pthread_mutex_destroy( (pthread_mutex_t*)mtxHandle)) { @@ -832,7 +868,7 @@ if (mtxHandle == NULL) return; #ifdef OS390BATCH - if (__isPosixOn()) { + if (isPosixEnabled) { #endif if (pthread_mutex_lock( (pthread_mutex_t*)mtxHandle)) { @@ -855,7 +891,7 @@ void* XMLPlatformUtils::makeMutex() { #ifdef OS390BATCH - if (__isPosixOn()) { + if (isPosixEnabled) { #endif pthread_mutex_t* mutex = new pthread_mutex_t; if (mutex == NULL) @@ -890,7 +926,7 @@ if (mtxHandle == NULL) return; #ifdef OS390BATCH - if (__isPosixOn()) { + if (isPosixEnabled) { #endif if (pthread_mutex_unlock( (pthread_mutex_t*)mtxHandle)) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]