Only try to use the membarrier on Linux
authorChristopher Dykes <cdykes@fb.com>
Tue, 26 Jul 2016 22:52:13 +0000 (15:52 -0700)
committerFacebook Github Bot 5 <facebook-github-bot-5-bot@fb.com>
Tue, 26 Jul 2016 22:53:46 +0000 (15:53 -0700)
Summary: It doesn't exist anywhere else, and `syscall` isn't even defined on Windows, so this completely failed to compile before.

Reviewed By: yfeldblum

Differential Revision: D3623382

fbshipit-source-id: 302093ddc96d6465e0dcc1883747229a7fb25a84

folly/portability/SysMembarrier.cpp

index 16fa5fb0770f5268a755b7c657e215fca570958a..7801000fad2a60f70fbc76d92229ec0b716bbac8 100644 (file)
@@ -21,7 +21,8 @@
 #include <folly/Portability.h>
 #include <folly/portability/Unistd.h>
 
-#if !defined(__NR_membarrier) && FOLLY_X64 && !FOLLY_MOBILE
+#if !defined(__NR_membarrier) && FOLLY_X64 && !FOLLY_MOBILE && \
+    defined(__linux__)
 #define __NR_membarrier 324
 #define MEMBARRIER_CMD_QUERY 0
 #define MEMBARRIER_CMD_SHARED 1