2013-04-16 23:58:04 -04:00
|
|
|
#if !defined(TOKU_ATOMIC_H)
|
|
|
|
#define TOKU_ATOMIC_H
|
|
|
|
|
2013-04-16 23:58:52 -04:00
|
|
|
#define TOKU_INLINE32 inline
|
|
|
|
|
|
|
|
static TOKU_INLINE32 int32_t toku_sync_fetch_and_add_int32(int32_t *a, int32_t b) {
|
|
|
|
return __sync_fetch_and_add(a, b);
|
|
|
|
}
|
|
|
|
|
2013-04-16 23:58:04 -04:00
|
|
|
#if __GNUC__ && __i386__
|
2013-04-16 23:58:52 -04:00
|
|
|
#define TOKU_INLINE64
|
2013-04-16 23:58:04 -04:00
|
|
|
// workaround for a gcc 4.1.2 bug on 32 bit platforms.
|
|
|
|
static uint64_t toku_sync_fetch_and_add_uint64(uint64_t *a, uint64_t b) __attribute__((noinline));
|
2013-04-16 23:58:52 -04:00
|
|
|
#else
|
|
|
|
#define TOKU_INLINE64 inline
|
2013-04-16 23:58:04 -04:00
|
|
|
#endif
|
|
|
|
|
2013-04-16 23:58:52 -04:00
|
|
|
static TOKU_INLINE64 uint64_t toku_sync_fetch_and_add_uint64(uint64_t *a, uint64_t b) {
|
2013-04-16 23:58:04 -04:00
|
|
|
return __sync_fetch_and_add(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|