From 3f71a9f03045d27f073f9cc371eef0aaed07e40e Mon Sep 17 00:00:00 2001 From: Vivian Kong Date: Mon, 3 Apr 2017 09:39:58 -0400 Subject: [PATCH] Fix compile error on s390x in shims/lock.h. s390x has a strong memory model and does not require membarrier. --- src/shims/lock.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shims/lock.h b/src/shims/lock.h index a22517e6e..3178793a9 100644 --- a/src/shims/lock.h +++ b/src/shims/lock.h @@ -89,7 +89,7 @@ _dispatch_lock_has_failed_trylock(dispatch_lock lock_value) #elif defined(__linux__) #include -#if !defined(__x86_64__) && !defined(__i386__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__s390x__) #include #endif #include @@ -542,8 +542,9 @@ DISPATCH_ALWAYS_INLINE static inline dispatch_once_t _dispatch_once_xchg_done(dispatch_once_t *pred) { -#if defined(__i386__) || defined(__x86_64__) +#if defined(__i386__) || defined(__x86_64__) || defined(__s390x__) // On Intel, any load is a load-acquire, so we don't need to be fancy + // same for s390x return os_atomic_xchg(pred, DLOCK_ONCE_DONE, release); #elif defined(__linux__) if (unlikely(syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0) < 0)) {