summaryrefslogtreecommitdiff
path: root/src/cairo-atomic.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-11-01 19:29:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2007-11-01 22:26:06 +0000
commit6e0151df469b67ea56c36f7b0050b5d5c959c67d (patch)
tree3d48af792b0147faa1ea7967f12c8dacb1b72530 /src/cairo-atomic.c
parenta26118cf5bf4063a4bdac2bece1bba0be776c801 (diff)
[cairo-atomic] Rearrange code under the correct ifdefs.
The atomic get/set depend upon NEED_MEMORY_BARRIER which is separate from HAVE_ATOMIC_OPS.
Diffstat (limited to 'src/cairo-atomic.c')
-rw-r--r--src/cairo-atomic.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/cairo-atomic.c b/src/cairo-atomic.c
index f9e4de72..9e388ac1 100644
--- a/src/cairo-atomic.c
+++ b/src/cairo-atomic.c
@@ -58,37 +58,39 @@ _cairo_atomic_int_dec_and_test (int *x)
}
int
-_cairo_atomic_int_get (int *x)
+_cairo_atomic_int_cmpxchg (int *x, int oldv, int newv)
{
int ret;
CAIRO_MUTEX_LOCK (_cairo_atomic_mutex);
ret = *x;
+ if (ret == oldv)
+ *x = newv;
CAIRO_MUTEX_UNLOCK (_cairo_atomic_mutex);
return ret;
}
-void
-_cairo_atomic_int_set (int *x, int value)
-{
- CAIRO_MUTEX_LOCK (_cairo_atomic_mutex);
- *x = value;
- CAIRO_MUTEX_UNLOCK (_cairo_atomic_mutex);
-}
+#endif
+#ifdef CAIRO_ATOMIC_OP_NEEDS_MEMORY_BARRIER
int
-_cairo_atomic_int_cmpxchg (int *x, int oldv, int newv)
+_cairo_atomic_int_get (int *x)
{
int ret;
CAIRO_MUTEX_LOCK (_cairo_atomic_mutex);
ret = *x;
- if (ret == oldv)
- *x = newv;
CAIRO_MUTEX_UNLOCK (_cairo_atomic_mutex);
return ret;
}
+void
+_cairo_atomic_int_set (int *x, int value)
+{
+ CAIRO_MUTEX_LOCK (_cairo_atomic_mutex);
+ *x = value;
+ CAIRO_MUTEX_UNLOCK (_cairo_atomic_mutex);
+}
#endif