From 98adecfbb44658b323886aafdd6728cdfee265bf Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 19 Apr 2018 22:10:34 +0300 Subject: [PATCH] Added cache line sizes for PowerPC and IBM Z. The cache line sizes were taken from Boost.Lockfree. --- src/lockpool.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lockpool.cpp b/src/lockpool.cpp index b669b86..a1292fa 100644 --- a/src/lockpool.cpp +++ b/src/lockpool.cpp @@ -42,9 +42,15 @@ namespace detail { namespace { -// This seems to be the maximum across all modern CPUs +// Cache line size, in bytes // NOTE: This constant is made as a macro because some compilers (gcc 4.4 for one) don't allow enums or namespace scope constants in alignment attributes +#if defined(__s390__) || defined(__s390x__) +#define BOOST_ATOMIC_CACHE_LINE_SIZE 256 +#elif defined(powerpc) || defined(__powerpc__) || defined(__ppc__) +#define BOOST_ATOMIC_CACHE_LINE_SIZE 128 +#else #define BOOST_ATOMIC_CACHE_LINE_SIZE 64 +#endif #if defined(BOOST_ATOMIC_USE_PTHREAD) typedef pthread_mutex_t lock_type;