26#ifndef _UCOMMON_ATOMIC_H_
27#define _UCOMMON_ATOMIC_H_
29#ifndef _UCOMMON_CONFIG_H_
33#if defined(_MSWINDOWS_)
63 mutable volatile atomic_t value;
71 atomic_t fetch_retain()
volatile;
72 atomic_t fetch_release()
volatile;
75 atomic_t fetch_add(atomic_t offset = 1)
volatile;
76 atomic_t fetch_sub(atomic_t offset = 1)
volatile;
78 atomic_t operator++()
volatile;
79 atomic_t operator--()
volatile;
80 atomic_t operator+=(atomic_t offset)
volatile;
81 atomic_t operator-=(atomic_t offset)
volatile;
82 atomic_t get()
volatile;
83 void clear()
volatile;
85 inline operator atomic_t()
volatile {
89 inline atomic_t operator*()
volatile {
103 mutable volatile atomic_t value __attribute__ ((aligned(16)));
105 mutable volatile atomic_t value;
133 class __EXPORT Aligned
136 __DELETE_DEFAULTS(Aligned);
142 Aligned(
size_t object,
size_t offset = 0);
148 template<
typename T,
unsigned alignment = 0>
149 class aligned :
public Aligned
152 inline T* get()
const {
153 return static_cast<T*
>(address);
157 inline aligned() : Aligned(sizeof(T), alignment) {
158 new((caddr_t)address) T;
161 inline T& operator*()
const {
162 return *(
static_cast<T*
>(address));
165 inline operator T&() {
169 inline void operator()(T value) {
174 static bool is_lockfree(
void);
Various miscellaneous platform specific headers and defines.
Common namespace for all ucommon objects.
Generic atomic class for referencing atomic objects and static functions.
bool acquire(void) volatile
NAMESPACE_UCOMMON Acquire the lock.
void wait(void) volatile
Wait for and aquire spinlock.
spinlock()
Construct and initialize spinlock.
void release(void) volatile
Release an acquired spinlock.