Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5cb15dd

Browse files
author
Nicolas Fauvet
committed
Add yield instruction for arm architectures
1 parent 569e0d0 commit 5cb15dd

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

Disruptor/BuildConfig.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232

3333
# define DISRUPTOR_CPP_11
3434

35-
# if __x86_64__ || __ppc64__
35+
# if __arm__
36+
# define DISRUPTOR_CPU_ARM
37+
# define DISRUPTOR_CPU_ARM_32
38+
# #elif __aarch64__
39+
# define DISRUPTOR_CPU_ARM
40+
# define DISRUPTOR_CPU_ARM_64
41+
# elif __x86_64__ || __ppc64__
3642
# define DISRUPTOR_CPU_64
3743
# else
3844
# define DISRUPTOR_CPU_32

Disruptor/SpinWait.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,18 @@ namespace Disruptor
118118

119119
#elif defined(DISRUPTOR_GNUC_COMPILER)
120120

121+
#if defined(DISRUPTOR_CPU_ARM)
121122
asm volatile
122-
(
123-
"rep\n"
124-
"nop"
125-
);
123+
(
124+
"yield"
125+
);
126+
#else
127+
asm volatile
128+
(
129+
"rep\n"
130+
"nop"
131+
);
132+
#endif
126133

127134
#else
128135

0 commit comments

Comments
 (0)