| Line | |
|---|
| 1 |
/* |
|---|
| 2 |
* Copyright (c) 2007, OmniTI Computer Consulting, Inc. |
|---|
| 3 |
* All rights reserved. |
|---|
| 4 |
*/ |
|---|
| 5 |
|
|---|
| 6 |
#ifndef UTILS_NOIT_ATOMIC_H |
|---|
| 7 |
#define UTILS_NOIT_ATOMIC_H |
|---|
| 8 |
|
|---|
| 9 |
#include "noit_config.h" |
|---|
| 10 |
|
|---|
| 11 |
typedef int32_t noit_atomic_t; |
|---|
| 12 |
typedef int64_t noit_atomic64_t; |
|---|
| 13 |
|
|---|
| 14 |
#ifdef HAVE_LIBKERN_OSATOMIC_H |
|---|
| 15 |
/* |
|---|
| 16 |
* This secion is for Darwin. |
|---|
| 17 |
* And we simply don't run on 32bit PPC. Life's a bitch. |
|---|
| 18 |
*/ |
|---|
| 19 |
#include <libkern/OSAtomic.h> |
|---|
| 20 |
typedef OSSpinLock noit_spinlock_t; |
|---|
| 21 |
#define noit_atomic_cas OSAtomicCompareAndSwap32 |
|---|
| 22 |
#define noit_atomic_cas64 OSAtomicCompareAndSwap64 |
|---|
| 23 |
#define noit_atomic_inc OSAtomicIncrement32 |
|---|
| 24 |
#define noit_atomic_inc64 OSAtomicIncrement64 |
|---|
| 25 |
#define noit_atomic_dec OSAtomicDecrement32 |
|---|
| 26 |
#define noit_atomic_dec64 OSAtomicDecrement64 |
|---|
| 27 |
#define noit_spinlock_lock OSSpinLockLock |
|---|
| 28 |
#define noit_spinlock_unlock OSSpinLockUnlock |
|---|
| 29 |
#define noit_spinlock_trylock OSSpinLockTry |
|---|
| 30 |
#else |
|---|
| 31 |
#error Please stub out the atomics section for your platform |
|---|
| 32 |
#endif |
|---|
| 33 |
|
|---|
| 34 |
#endif |
|---|