diff options
Diffstat (limited to 'src/leveldb/port/atomic_pointer.h')
-rw-r--r-- | src/leveldb/port/atomic_pointer.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/leveldb/port/atomic_pointer.h b/src/leveldb/port/atomic_pointer.h index a9866b2302..9bf091f757 100644 --- a/src/leveldb/port/atomic_pointer.h +++ b/src/leveldb/port/atomic_pointer.h @@ -5,14 +5,13 @@ // AtomicPointer provides storage for a lock-free pointer. // Platform-dependent implementation of AtomicPointer: // - If the platform provides a cheap barrier, we use it with raw pointers -// - If cstdatomic is present (on newer versions of gcc, it is), we use -// a cstdatomic-based AtomicPointer. However we prefer the memory +// - If <atomic> is present (on newer versions of gcc, it is), we use +// a <atomic>-based AtomicPointer. However we prefer the memory // barrier based version, because at least on a gcc 4.4 32-bit build -// on linux, we have encountered a buggy <cstdatomic> -// implementation. Also, some <cstdatomic> implementations are much -// slower than a memory-barrier based implementation (~16ns for -// <cstdatomic> based acquire-load vs. ~1ns for a barrier based -// acquire-load). +// on linux, we have encountered a buggy <atomic> implementation. +// Also, some <atomic> implementations are much slower than a memory-barrier +// based implementation (~16ns for <atomic> based acquire-load vs. ~1ns for +// a barrier based acquire-load). // This code is based on atomicops-internals-* in Google's perftools: // http://code.google.com/p/google-perftools/source/browse/#svn%2Ftrunk%2Fsrc%2Fbase @@ -20,8 +19,8 @@ #define PORT_ATOMIC_POINTER_H_ #include <stdint.h> -#ifdef LEVELDB_CSTDATOMIC_PRESENT -#include <cstdatomic> +#ifdef LEVELDB_ATOMIC_PRESENT +#include <atomic> #endif #ifdef OS_WIN #include <windows.h> @@ -126,7 +125,7 @@ class AtomicPointer { }; // AtomicPointer based on <cstdatomic> -#elif defined(LEVELDB_CSTDATOMIC_PRESENT) +#elif defined(LEVELDB_ATOMIC_PRESENT) class AtomicPointer { private: std::atomic<void*> rep_; @@ -207,7 +206,7 @@ class AtomicPointer { inline void NoBarrier_Store(void* v) { rep_ = v; } }; -// We have neither MemoryBarrier(), nor <cstdatomic> +// We have neither MemoryBarrier(), nor <atomic> #else #error Please implement AtomicPointer for this platform. |