From 76a0b73e8102c5bfb5cb791e34992472f5d1d33e Mon Sep 17 00:00:00 2001 From: Torvald Riegel Date: Tue, 14 Jun 2016 15:12:00 +0200 Subject: Remove atomic_compare_and_exchange_bool_rel. atomic_compare_and_exchange_bool_rel and catomic_compare_and_exchange_bool_rel are removed and replaced with the new C11-like atomic_compare_exchange_weak_release. The concurrent code in nscd/cache.c has not been reviewed yet, so this patch does not add detailed comments. * nscd/cache.c (cache_add): Use new C11-like atomic operation instead of atomic_compare_and_exchange_bool_rel. * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Likewise. * include/atomic.h (atomic_compare_and_exchange_bool_rel, catomic_compare_and_exchange_bool_rel): Remove. * sysdeps/aarch64/atomic-machine.h (atomic_compare_and_exchange_bool_rel): Likewise. * sysdeps/alpha/atomic-machine.h (atomic_compare_and_exchange_bool_rel): Likewise. * sysdeps/arm/atomic-machine.h (atomic_compare_and_exchange_bool_rel): Likewise. * sysdeps/mips/atomic-machine.h (atomic_compare_and_exchange_bool_rel): Likewise. * sysdeps/tile/atomic-machine.h (atomic_compare_and_exchange_bool_rel): Likewise. --- nscd/cache.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nscd/cache.c') diff --git a/nscd/cache.c b/nscd/cache.c index 3021abd41e..daa0b2bfd1 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -178,12 +178,12 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet, assert ((newp->packet & BLOCK_ALIGN_M1) == 0); /* Put the new entry in the first position. */ - do - newp->next = table->head->array[hash]; - while (atomic_compare_and_exchange_bool_rel (&table->head->array[hash], - (ref_t) ((char *) newp - - table->data), - (ref_t) newp->next)); + /* TODO Review concurrency. Use atomic_exchange_release. */ + newp->next = atomic_load_relaxed (&table->head->array[hash]); + while (!atomic_compare_exchange_weak_release (&table->head->array[hash], + (ref_t *) &newp->next, + (ref_t) ((char *) newp + - table->data))); /* Update the statistics. */ if (packet->notfound) -- cgit 1.4.1