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
main
Gunnar Kudrjavets 7 years ago committed by Facebook Github Bot
parent 2cd00773c7
commit 0b69e50791
  1. 2
      port/port_posix.h
  2. 2
      port/win/port_win.h

@ -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)

@ -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)

Loading…
Cancel
Save