Commit graph

12 commits

Author SHA1 Message Date
Chris Wilson
aa495eac5a atomic: Tweak for compilation x86.
Missing definition of _cairo_atomic_ptr_get() used in the fallbacks.
2010-04-29 10:04:54 +01:00
Andrea Canciani
d66b1ca1cf atomic: Separate bool and old-value compare-and-exchange
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-29 10:52:47 +02:00
Andrea Canciani
a0bf424b82 atomic: Remove unused function _cairo_atomic_int_set()
_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-29 10:52:47 +02:00
Andrea Canciani
b8a7f8621a Update FSF address
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-04-27 11:13:38 +02:00
Chris Wilson
e3e7464145 atomic: Fix up compile on PPC with libatomic-ops 2010-01-29 11:24:40 +00:00
M Joonas Pihlaja
80990c7f72 [atomic] Use an integer __sync_val_compare_and_swap() for pointer CAS.
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-21 17:34:12 +03:00
Chris Wilson
4ae5e2d445 [atomic] Provide mutex-based ptr cmpxchg
To handle those CPUs where we do not have an atomic cmpxchg.
2009-06-05 18:29:40 +01:00
Behdad Esfahbod
fee72c26af Make sure feature macros are checked using #if, not #ifdef; add a test for it
This is more robust to cases where people want to assign 0 to those variables.
(win32/alternate build systems, etc)
2008-09-20 17:20:36 -04:00
Behdad Esfahbod
44155f7e59 Cleanup configure.in macros 2008-09-04 16:08:41 -04:00
Chris Wilson
6e0151df46 [cairo-atomic] Rearrange code under the correct ifdefs.
The atomic get/set depend upon NEED_MEMORY_BARRIER which is separate
from HAVE_ATOMIC_OPS.
2007-11-01 22:26:06 +00:00
Chris Wilson
71120727e1 [cairo-atomic] Use an atomic operation to set the status on a shared resource.
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-10-04 11:26:44 +01:00
Chris Wilson
8b6c871c90 [cairo-atomic] Introduce atomic ops.
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.
2007-09-25 16:29:54 +01:00