Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
avoid using _ReadWriteBarrier when _DEBUG is defined under MSVC
Browse files Browse the repository at this point in the history
http://connect.microsoft.com/VisualStudio/feedback/details/100051/readwritebarrier-intrinsic-fails-to-link-without-oi-or-pragma-intrinsic

P4 Change 11080642 on 2011/10/03 13:01:04 by nbell

--HG--
branch : 1.5.0
extra : transplant_source : %07%99bc%40%60%D9%E6%3B%25%FF%DF%BBw%F1TL%26%83G
  • Loading branch information
wnbell committed Oct 3, 2011
1 parent 01cd9c7 commit 037b1b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 1 addition & 7 deletions .LATEST_P4_CHANGELIST
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
--- .LATEST_P4_CHANGELIST
+++ .LATEST_P4_CHANGELIST
@@ -1,1 +1,1 @@
-11016751
\ No newline at end of file
+11046532
\ No newline at end of file
11080642
11 changes: 9 additions & 2 deletions thrust/detail/config/compiler_fence.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@
// msvc case
#if THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC

#ifndef _DEBUG

#include <intrin.h>
#pragma intrinsic(_ReadWriteBarrier)
#define __thrust_compiler_fence() _ReadWriteBarrier()
#else

#define __thrust_compiler_fence() do {} while (0)

#endif // _DEBUG

// gcc case
#elif THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC
Expand All @@ -35,7 +42,7 @@
#define __thrust_compiler_fence() __sync_synchronize()
#else
// allow the code to compile without any guarantees
#define __thrust_compiler_fence()
#define __thrust_compiler_fence() do {} while (0)
#endif // THRUST_GCC_VERSION

// clean up after ourselves
Expand All @@ -45,7 +52,7 @@
#elif THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_UNKNOWN

// allow the code to compile without any guarantees
#define __thrust_compiler_fence()
#define __thrust_compiler_fence() do {} while (0)

#endif

0 comments on commit 037b1b7

Please sign in to comment.