summaryrefslogtreecommitdiff
path: root/platform/iphone/platform_refcount.h
blob: 45391e651ae2a98015cd17e2f20a5be8696836df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "safe_refcount.h"

#ifdef IPHONE_ENABLED

#define REFCOUNT_T int
#define REFCOUNT_GET_T int const volatile&

#include <libkern/OSAtomic.h>

inline int atomic_conditional_increment(volatile int* v) {
	return (*v==0)? 0 : OSAtomicIncrement32(v);
}

inline int atomic_decrement(volatile int* v) {
	return OSAtomicDecrement32(v);
}

#endif