niukuo commented on a change in pull request #924: adapt to Arm64
URL: https://github.com/apache/incubator-brpc/pull/924#discussion_r326973743
 
 

 ##########
 File path: src/bthread/processor.h
 ##########
 @@ -23,9 +23,17 @@
 #ifndef BTHREAD_PROCESSOR_H
 #define BTHREAD_PROCESSOR_H
 
+#include "butil/build_config.h"
+
 // Pause instruction to prevent excess processor bus usage, only works in GCC
 # ifndef cpu_relax
+#if defined(ARCH_CPU_X86_FAMILY)
+# define cpu_relax() asm volatile("pause\n": : :"memory")
+#elif defined(ARCH_CPU_ARM_FAMILY)
+# define cpu_relax() asm volatile("yield\n": : :"memory")
+#else
 # define cpu_relax() asm volatile("pause\n": : :"memory")
+#endif
 
 Review comment:
   可以 这里没有合并是考虑以后适配其它平台可能会增加elseif,最终的默认行为可能会变成其它代码,所以这里把x86和arm64单列出来。
   以上是我的考虑 你的意见是?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to