diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-10-13 16:10:39 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-10-15 13:05:46 +0100 |
commit | ef9286751d8346ecb803bfb5916581ee4dfc84db (patch) | |
tree | 2e78392a19f1a0a2d07fb8408b85e4f98ac58cfe /src/cairo-xlib-screen.c | |
parent | d85eda97dd9116f51e0255b29652f4b52ba4f8e9 (diff) |
[atomic] Fallback to libatomic-ops-dev
Use libatomic-ops-dev in preference to mutex-based atomics, if we do not
have the builtin atomic intrinsics available.
Diffstat (limited to 'src/cairo-xlib-screen.c')
-rw-r--r-- | src/cairo-xlib-screen.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c index 79d8c0dec..fc2535b94 100644 --- a/src/cairo-xlib-screen.c +++ b/src/cairo-xlib-screen.c @@ -269,7 +269,8 @@ _cairo_xlib_screen_close_display (cairo_xlib_screen_t *info) { cairo_xlib_visual_info_t **visuals; Display *dpy; - int i, old; + cairo_atomic_int_t old; + int i; CAIRO_MUTEX_LOCK (info->mutex); @@ -277,7 +278,7 @@ _cairo_xlib_screen_close_display (cairo_xlib_screen_t *info) #if HAS_ATOMIC_OPS do { - old = info->gc_depths; + old = _cairo_atomic_int_get (&info->gc_depths); } while (_cairo_atomic_int_cmpxchg (&info->gc_depths, old, 0) != old); #else old = info->gc_depths; @@ -384,7 +385,8 @@ _cairo_xlib_screen_get_gc (cairo_xlib_screen_t *info, Drawable drawable) { XGCValues gcv; - int i, new, old; + cairo_atomic_int_t old, new; + int i; GC gc; do { @@ -393,13 +395,13 @@ _cairo_xlib_screen_get_gc (cairo_xlib_screen_t *info, if (old == 0) break; - if (((old >> 0) & 0xff) == depth) + if (((old >> 0) & 0xff) == (unsigned) depth) i = 0; - else if (((old >> 8) & 0xff) == depth) + else if (((old >> 8) & 0xff) == (unsigned) depth) i = 1; - else if (((old >> 16) & 0xff) == depth) + else if (((old >> 16) & 0xff) == (unsigned) depth) i = 2; - else if (((old >> 24) & 0xff) == depth) + else if (((old >> 24) & 0xff) == (unsigned) depth) i = 3; else break; |