Author: carnold
Date: Tue Nov 20 20:31:09 2007
New Revision: 596934
URL: http://svn.apache.org/viewvc?rev=596934&view=rev
Log:
LOGCXX-186: Drop mutex guarding of ObjectPtrBase::exchange
Modified:
logging/log4cxx/trunk/src/main/cpp/objectptr.cpp
Modified: logging/log4cxx/trunk/src/main/cpp/objectptr.cpp
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/objectptr.cpp?rev=596934&r1=596933&r2=596934&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/objectptr.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/objectptr.cpp Tue Nov 20 20:31:09 2007
@@ -33,12 +33,12 @@
}
void* ObjectPtrBase::exchange(void** destination, void* newValue) {
-#if APR_SIZEOF_VOIDP == 4
+#if _WIN32 && (!defined(_MSC_VER) || _MSC_VER >= 1300)
+ return InterlockedExchangePointer(destination, newValue);
+#elif APR_SIZEOF_VOIDP == 4
return (void*) apr_atomic_xchg32((volatile apr_uint32_t*) destination,
(apr_uint32_t) newValue);
#else
- static Mutex mutex(APRInitializer::getRootPool());
- synchronized sync(mutex);
void* oldValue = *destination;
*destination = newValue;
return oldValue;