stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r612430 - /stdcxx/branches/4.2.x/include/rw/_mutex.h
Date Wed, 16 Jan 2008 12:11:34 GMT
Author: faridz
Date: Wed Jan 16 04:11:24 2008
New Revision: 612430

URL: http://svn.apache.org/viewvc?rev=612430&view=rev
Log:
2008-01-16  Farid Zaripov  <farid_zaripov@epam.com>

	* include/rw/_mutex.h: Use intrinsic interlocked functions on MSVC 7.1 and ICC.
	Declare the interlocked functions instead of #including <intrin.h>.

Modified:
    stdcxx/branches/4.2.x/include/rw/_mutex.h

Modified: stdcxx/branches/4.2.x/include/rw/_mutex.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_mutex.h?rev=612430&r1=612429&r2=612430&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_mutex.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_mutex.h Wed Jan 16 04:11:24 2008
@@ -119,6 +119,12 @@
 #    include <windows.h>
 #    define _RWSTD_MUTEX_T _RTL_CRITICAL_SECTION
 
+#    ifndef _MSC_VER
+#      define _InterlockedIncrement InterlockedIncrement
+#      define _InterlockedDecrement InterlockedDecrement
+#      define _InterlockedExchange  InterlockedExchange
+#    endif    // _MSC_VER
+
 #  else   // if defined (_RWSTD_NO_FWD_DECLARATIONS)
 
    // avoid #including this header (MFC doesn't like it)
@@ -142,7 +148,7 @@
 DeleteCriticalSection (_RTL_CRITICAL_SECTION*);
 
 
-#if defined _RWSTD_INTERLOCKED_T && (!defined (_MSC_VER) || _MSC_VER < 1400)
+#if defined (_RWSTD_INTERLOCKED_T) && !defined (_MSC_VER)
 
 __declspec (dllimport) long __stdcall
 InterlockedIncrement (_RWSTD_INTERLOCKED_T*);
@@ -157,7 +163,7 @@
 #  define _InterlockedDecrement InterlockedDecrement
 #  define _InterlockedExchange  InterlockedExchange
 
-#endif   // _RWSTD_INTERLOCKED_T && (!_MSC_VER || _MSC_VER < 1400)
+#endif   // _RWSTD_INTERLOCKED_T && !_MSC_VER
 
 }   // extern "C"
 
@@ -176,21 +182,35 @@
 
 #  endif   // _RWSTD_NO_FWD_DECLARATIONS
 
-#  if defined (_MSC_VER) && _MSC_VER >= 1400 && !defined (__INTEL_COMPILER)
-#    include <intrin.h>
-
-#    pragma intrinsic (_InterlockedIncrement)
-#    pragma intrinsic (_InterlockedIncrement16)
-#    pragma intrinsic (_InterlockedDecrement)
-#    pragma intrinsic (_InterlockedDecrement16)
-#    pragma intrinsic (_InterlockedExchange)
+#  ifdef _MSC_VER
+extern "C" long __cdecl _InterlockedIncrement (volatile long*);
+extern "C" long __cdecl _InterlockedDecrement (volatile long*);
+extern "C" long __cdecl _InterlockedExchange (volatile long*, long);
+#    ifndef __INTEL_COMPILER
+#      pragma intrinsic (_InterlockedIncrement)
+#      pragma intrinsic (_InterlockedDecrement)
+#      pragma intrinsic (_InterlockedExchange)
+#    endif   // __INTEL_COMPILER
+
+#    if _MSC_VER >= 1400 && !defined (__INTEL_COMPILER)
+extern "C" short __cdecl _InterlockedIncrement16 (volatile short*);
+extern "C" short __cdecl _InterlockedDecrement16 (volatile short*);
+#      pragma intrinsic (_InterlockedIncrement16)
+#      pragma intrinsic (_InterlockedDecrement16)
+#    endif   // _MSC_VER >= 1400 && !__INTEL_COMPILER
 
 #    ifdef _M_X64
-#      pragma intrinsic (_InterlockedIncrement64)
-#      pragma intrinsic (_InterlockedDecrement64)
-#      pragma intrinsic (_InterlockedExchange64)
-#    endif
-#  endif   // _MSC_VER >= 1400 && !__INTEL_COMPILER
+extern "C" long long __cdecl _InterlockedIncrement64 (volatile long long*);
+extern "C" long long __cdecl _InterlockedDecrement64 (volatile long long*);
+extern "C" long long __cdecl _InterlockedExchange64 (volatile long long*,
+                                                     long long);
+#      ifndef __INTEL_COMPILER
+#        pragma intrinsic (_InterlockedIncrement64)
+#        pragma intrinsic (_InterlockedDecrement64)
+#        pragma intrinsic (_InterlockedExchange64)
+#      endif   // __INTEL_COMPILER
+#    endif   // _M_X64
+#  endif   // _MSC_VER
 
 
 _RWSTD_NAMESPACE (__rw) { 



Mime
View raw message