summaryrefslogtreecommitdiff
path: root/src/cairo-atomic.c
AgeCommit message (Collapse)AuthorFilesLines
2010-04-29atomic: Tweak for compilation x86.Chris Wilson1-8/+8
Missing definition of _cairo_atomic_ptr_get() used in the fallbacks.
2010-04-29atomic: Separate bool and old-value compare-and-exchangeAndrea Canciani1-2/+2
Some implementations only offer one version of compare-and-exchange, thus we expose both through cairo-atomic, implementing what is missing through appropriate fallbacks. *_cmpxchg() now return a boolean (this unbreaks _cairo_atomic_uint_cmpxchg) *_cmpxchg_return_old() return the old value Code is updated everywhere to reflect this, by using *_cmpxchg() wherever the returned value was only tested to check if the exchange had really taken place. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-04-29atomic: Remove unused function _cairo_atomic_int_set()Andrea Canciani1-8/+0
_cairo_atomic_int_set() was only used in the definition of CAIRO_REFERENCE_SET_VALUE, which was never used. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-04-27Update FSF addressAndrea Canciani1-1/+1
I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
2010-01-29atomic: Fix up compile on PPC with libatomic-opsChris Wilson1-1/+2
2009-06-21[atomic] Use an integer __sync_val_compare_and_swap() for pointer CAS.M Joonas Pihlaja1-1/+5
Fix an implicit pointer/integer cast in _cairo_atomic_ptr_cmpxchg() when building with LLVM/clang. The Intel synchronization primitives __sync_val_compare_and_swap() are only defined by Intel for types int, long, long long and their unsigned variants. This patch uses one of those for _cairo_atomic_ptr_cmpxchg() instead of relying on a gcc extension of __sync_val_compare_and_swap() to pointer types.
2009-06-05[atomic] Provide mutex-based ptr cmpxchgChris Wilson1-0/+13
To handle those CPUs where we do not have an atomic cmpxchg.
2008-09-20Make sure feature macros are checked using #if, not #ifdef; add a test for itBehdad Esfahbod1-1/+1
This is more robust to cases where people want to assign 0 to those variables. (win32/alternate build systems, etc)
2008-09-04Cleanup configure.in macrosBehdad Esfahbod1-1/+1
2007-11-01[cairo-atomic] Rearrange code under the correct ifdefs.Chris Wilson1-11/+13
The atomic get/set depend upon NEED_MEMORY_BARRIER which is separate from HAVE_ATOMIC_OPS.
2007-10-04[cairo-atomic] Use an atomic operation to set the status on a shared resource.Chris Wilson1-0/+15
Since the objects can be shared and may be in use simultaneously across multiple threads, setting the status needs to be atomic. We use a locked compare and exchange in order to avoid overwriting an existing error - that is we use an atomic operation that only sets the new status value if the current value is CAIRO_STATUS_SUCCESS.
2007-09-25[cairo-atomic] Introduce atomic ops.Chris Wilson1-0/+79
Test for the availability of the Intel __sync_* atomic primitives and use them to define a few operations useful for reference counting - providing a generic interface that may be targeted at more architectures in the future. If no atomic primitives are available, use a mutex based variant. If the contention on that mutex is too high, we can consider using an array of mutexes using the address of the atomic variable as the hash.