libfoedus-core
FOEDUS Core Library
atomic_fences.hpp File Reference

Atomic fence methods and load/store with fences that work for both C++11/non-C++11 code. More...

Detailed Description

Atomic fence methods and load/store with fences that work for both C++11/non-C++11 code.

Especially on TSO architecture like x86, most memory fence is trivial thus supposedly very fast. Invoking a non-inlined function for memory fence is thus not ideal. The followings define memory fences for public headers that need them for inline methods. We use gcc/clang's builtin (__atomic_thread_fence) to avoid C++11 code. The code was initially written for gcc, but turns out that clang also supports all of them for gcc compatibility. Hallelujah, clang.

Definition in file atomic_fences.hpp.

#include <stdint.h>
Include dependency graph for atomic_fences.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 foedus
 Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
 
 foedus::assorted
 Assorted Methods/Classes that are too subtle to have their own packages.
 

Functions

void foedus::assorted::memory_fence_acquire ()
 Equivalent to std::atomic_thread_fence(std::memory_order_acquire). More...
 
void foedus::assorted::memory_fence_release ()
 Equivalent to std::atomic_thread_fence(std::memory_order_release). More...
 
void foedus::assorted::memory_fence_acq_rel ()
 Equivalent to std::atomic_thread_fence(std::memory_order_acq_rel). More...
 
void foedus::assorted::memory_fence_consume ()
 Equivalent to std::atomic_thread_fence(std::memory_order_consume). More...
 
void foedus::assorted::memory_fence_seq_cst ()
 Equivalent to std::atomic_thread_fence(std::memory_order_seq_cst). More...
 
template<typename T >
foedus::assorted::atomic_load_seq_cst (const T *target)
 Atomic load with a seq_cst barrier for raw primitive types rather than std::atomic<T>. More...
 
template<typename T >
foedus::assorted::atomic_load_acquire (const T *target)
 Atomic load with an acquire barrier for raw primitive types rather than std::atomic<T>. More...
 
template<typename T >
foedus::assorted::atomic_load_consume (const T *target)
 Atomic load with a consume barrier for raw primitive types rather than std::atomic<T>. More...
 
template<typename T >
void foedus::assorted::atomic_store_seq_cst (T *target, T value)
 Atomic store with a seq_cst barrier for raw primitive types rather than std::atomic<T>. More...
 
template<typename T >
void foedus::assorted::atomic_store_release (T *target, T value)
 Atomic store with a release barrier for raw primitive types rather than std::atomic<T>. More...