[cairo] Atomic reference counting
Behdad Esfahbod
behdad at behdad.org
Mon Sep 24 14:10:44 PDT 2007
On Sun, 2007-09-23 at 22:14 +0100, Chris Wilson wrote:
>
> +AC_ARG_ENABLE(atomics,
> + AS_HELP_STRING([--disable-atomics],
> + [Do not use atomic operations]),
Humm, what do you see as the usecase for this? If we want to do
something like this it should be like --disable-mt and imply NO_MUTEX
too.
> + [use_atomic=$enableval], [use_atomic=auto])
> +if test "x$use_atomic" != "xno"; then
> + AC_TRY_COMPILE([int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }], [],
> + AC_DEFINE(CAIRO_HAS_ATOMIC_OPS, 1, [Enable if your platform has native atomic operations])
> + AC_DEFINE(CAIRO_HAS_INTEL_ATOMIC_PRIMITIVES, 1, [Enable if your compiler supports the Intel __sync_* atomic primitives])
I was thinking about defining CAIRO_HAS_ATOMIC_OPS automatically in the
header file based on whether any concrete implementation was found. As
in:
#define CAIRO_HAS_ATOMIC_OPS 1
#if CAIRO_HAS_INTEL_ATOMIC_PRIMITIVES
...
#elif CAIRO_HAS_SOMEOTHER_ATOMIC_PRIMITIES
...
#else
...
# undef CAIRO_HAS_ATOMIC_OPS
#end
> + )
> +fi
> +
The rest looks good. Thanks. Feel free to push.
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo
mailing list