Fix atomic-int op on Apple

The OSAtomicAdd32Barrier operator returns the new value, we want the
old value.
This commit is contained in:
Behdad Esfahbod 2012-03-01 17:30:29 -08:00
parent a1970d9afc
commit bc71ad4973
2 changed files with 2 additions and 2 deletions

View File

@ -301,7 +301,7 @@ _try_writable (hb_blob_t *blob)
return TRUE;
DEBUG_MSG_FUNC (BLOB, blob, "currect data is -> %p\n", blob->data);
DEBUG_MSG_FUNC (BLOB, blob, "current data is -> %p\n", blob->data);
char *new_data;

View File

@ -72,7 +72,7 @@ typedef long hb_atomic_int_t;
#include <libkern/OSAtomic.h>
typedef int32_t hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) OSAtomicAdd32Barrier(V, &(AI))
#define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier((V), &(AI)), (AI) - (V))
#define hb_atomic_int_get(AI) OSAtomicAdd32Barrier(0, &(AI))
#else