Browse Source

Use intrinsic functions for memory barriers instead of inline assembly (#327)

Милош Тошић 1 year ago
parent
commit
d171a0f264
1 changed files with 3 additions and 3 deletions
  1. 3 3
      include/bx/inline/cpu.inl

+ 3 - 3
include/bx/inline/cpu.inl

@@ -70,7 +70,7 @@ namespace bx
 #if BX_COMPILER_MSVC
 		_ReadBarrier();
 #else
-		asm volatile("":::"memory");
+		__atomic_thread_fence(__ATOMIC_RELEASE);
 #endif // BX_COMPILER_*
 	}
 
@@ -79,7 +79,7 @@ namespace bx
 #if BX_COMPILER_MSVC
 		_WriteBarrier();
 #else
-		asm volatile("":::"memory");
+		__atomic_thread_fence(__ATOMIC_ACQUIRE);
 #endif // BX_COMPILER_*
 	}
 
@@ -88,7 +88,7 @@ namespace bx
 #if BX_COMPILER_MSVC
 		_ReadWriteBarrier();
 #else
-		asm volatile("":::"memory");
+		__atomic_thread_fence(__ATOMIC_ACQ_REL);
 #endif // BX_COMPILER_*
 	}