[PATCH 3/5] include: Add YieldProcessor().

Zebediah Figura z.figura12 at gmail.com
Wed Jan 20 22:35:47 CST 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 include/winnt.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/winnt.h b/include/winnt.h
index d8abb8bde70..d933b26c0ec 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -7154,6 +7154,19 @@ static FORCEINLINE void MemoryBarrier(void)
 
 #endif  /* __GNUC__ */
 
+static FORCEINLINE void YieldProcessor(void)
+{
+#ifdef __GNUC__
+#if defined(__i386__) || defined(__x86_64__)
+    __asm__ __volatile__( "rep; nop" : : : "memory" );
+#elif defined(__arm__) || defined(__aarch64__)
+    __asm__ __volatile__( "dmb ishst; yield" : : : "memory" );
+#else
+    __asm__ __volatile__( "" : : : "memory" );
+#endif
+#endif
+}
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.29.2




More information about the wine-devel mailing list