[cairo] Atomic reference counting

Chris Wilson chris at chris-wilson.co.uk
Fri Sep 21 14:43:45 PDT 2007

Long ago I promised to reimplement reference counting on top of the gcc
built-in atomic ops. This work was then pushed behind the memfault
series of corrections (WIP), as I intended to do it as part of the
cairo_object_t cleanup. However my testing now includes multi-threaded
stress tests and the random deaths associated with non-atomic reference
counting have reared their ugly heads and so it's time has come once

The first patch adds the atomic ops (specifically the two required for
reference counting) with a fallback to a mutex based path if the Intel
__sync__* primitives are not available. There's plenty of room for
improvement for different architectures here.

The second patch converts the reference counting within cairo over to
the new primitives.

Please review.
Chris Wilson
-------------- next part --------------

More information about the cairo mailing list