Define CACHE_LINE_SIZE only when it's not defined

Summary:
RocksDB is compiled as part of MyRocks (MySQL storage engine) build.
MySQL already defines `CACHE_LINE_SIZE` and therefore we're getting a
conflict. Change RocksDB definition to be more cognizant of this.
Closes https://github.com/facebook/rocksdb/pull/2257

Differential Revision: D5013188

Pulled By: gunnarku

fbshipit-source-id: cfa76fe99f90dcd82aa09204e2f1f35e07a82b41
This commit is contained in:
Gunnar Kudrjavets 2017-05-08 16:04:19 -07:00 committed by Facebook Github Bot
parent 2cd00773c7
commit 0b69e50791
2 changed files with 4 additions and 0 deletions

View File

@ -185,7 +185,9 @@ typedef pthread_once_t OnceType;
#define LEVELDB_ONCE_INIT PTHREAD_ONCE_INIT
extern void InitOnce(OnceType* once, void (*initializer)());
#ifndef CACHE_LINE_SIZE
#define CACHE_LINE_SIZE 64U
#endif
#define PREFETCH(addr, rw, locality) __builtin_prefetch(addr, rw, locality)

View File

@ -237,7 +237,9 @@ struct OnceType {
#define LEVELDB_ONCE_INIT port::OnceType::Init()
extern void InitOnce(OnceType* once, void (*initializer)());
#ifndef CACHE_LINE_SIZE
#define CACHE_LINE_SIZE 64U
#endif
static inline void AsmVolatilePause() {
#if defined(_M_IX86) || defined(_M_X64)