}
__pthread_setid (pthread->thread, NULL);
- atomic_decrement (&__pthread_total);
+ atomic_fetch_add_relaxed (&__pthread_total, -1);
failed_sigstate:
__pthread_sigstate_destroy (pthread);
failed_setup:
|| __glibc_unlikely (!powerof2 (mem & (pagesize - 1))))
malloc_printerr ("munmap_chunk(): invalid pointer");
- atomic_decrement (&mp_.n_mmaps);
+ atomic_fetch_add_relaxed (&mp_.n_mmaps, -1);
atomic_fetch_add_relaxed (&mp_.mmapped_mem, -total_size);
/* If munmap failed the process virtual memory address space is in a
@c
@c Given the use atomic operations this function seems
@c to be AS-safe. It is AC-unsafe because there is still
-@c a window between atomic_decrement and the pthread_push
+@c a window between atomic_fetch_add_relaxed and the pthread_push
@c of the handler that undoes that operation. A cancellation
@c at that point would fail to remove the process from the
@c waiters count.
@c lll_lock (pd->lock) @asulock @aculock
@c atomic_increment ok
@c clone ok
-@c atomic_decrement ok
+@c atomic_fetch_add_relaxed ok
@c atomic_exchange_acq ok
@c lll_futex_wake ok
@c deallocate_stack dup
self->setxid_futex = 1;
futex_wake (&self->setxid_futex, 1, FUTEX_PRIVATE);
- if (atomic_decrement_val (&xidcmd->cntr) == 0)
+ if (atomic_fetch_add_relaxed (&xidcmd->cntr, -1) == 1)
futex_wake ((unsigned int *) &xidcmd->cntr, 1, FUTEX_PRIVATE);
}
libc_hidden_def (__nptl_setxid_sighandler)
NOTES above). */
/* Oops, we lied for a second. */
- atomic_decrement (&__nptl_nthreads);
+ atomic_fetch_add_relaxed (&__nptl_nthreads, -1);
/* Free the resources. */
__nptl_deallocate_stack (pd);
return -1;
}
- if (atomic_decrement_val (&map->counter) == 0)
+ if (atomic_fetch_add_relaxed (&map->counter, -1) == 1)
__nscd_unmap (map);
}
if ((gc_cycle & 1) != 0 || ++nretries == 5 || retval == -1)
{
/* nscd is just running gc now. Disable using the mapping. */
- if (atomic_decrement_val (&mapped->counter) == 0)
+ if (atomic_fetch_add_relaxed (&mapped->counter, -1) == 1)
__nscd_unmap (mapped);
mapped = NO_MAPPING;
}
if ((gc_cycle & 1) != 0 || ++nretries == 5 || retval == -1)
{
/* nscd is just running gc now. Disable using the mapping. */
- if (atomic_decrement_val (&mapped->counter) == 0)
+ if (atomic_fetch_add_relaxed (&mapped->counter, -1) == 1)
__nscd_unmap (mapped);
mapped = NO_MAPPING;
}
if ((gc_cycle & 1) != 0 || ++nretries == 5 || retval == -1)
{
/* nscd is just running gc now. Disable using the mapping. */
- if (atomic_decrement_val (&mapped->counter) == 0)
+ if (atomic_fetch_add_relaxed (&mapped->counter, -1) == 1)
__nscd_unmap (mapped);
mapped = NO_MAPPING;
}
if ((gc_cycle & 1) != 0 || ++nretries == 5 || retval == -1)
{
/* nscd is just running gc now. Disable using the mapping. */
- if (atomic_decrement_val (&mapped->counter) == 0)
+ if (atomic_fetch_add_relaxed (&mapped->counter, -1) == 1)
__nscd_unmap (mapped);
mapped = NO_MAPPING;
}
if ((gc_cycle & 1) != 0 || ++nretries == 5 || retval == -1)
{
/* nscd is just running gc now. Disable using the mapping. */
- if (atomic_decrement_val (&mapped->counter) == 0)
+ if (atomic_fetch_add_relaxed (&mapped->counter, -1) == 1)
__nscd_unmap (mapped);
mapped = NO_MAPPING;
}
struct mapped_database *oldval = *mappedp;
*mappedp = result;
- if (oldval != NULL && atomic_decrement_val (&oldval->counter) == 0)
+ if (oldval != NULL && atomic_fetch_add_relaxed (&oldval->counter, -1) == 1)
__nscd_unmap (oldval);
return result;
if ((gc_cycle & 1) != 0 || ++nretries == 5 || retval == -1)
{
/* nscd is just running gc now. Disable using the mapping. */
- if (atomic_decrement_val (&mapped->counter) == 0)
+ if (atomic_fetch_add_relaxed (&mapped->counter, -1) == 1)
__nscd_unmap (mapped);
mapped = NO_MAPPING;
}
if ((gc_cycle & 1) != 0 || ++nretries == 5 || retval == -1)
{
/* nscd is just running gc now. Disable using the mapping. */
- if (atomic_decrement_val (&mapped->counter) == 0)
+ if (atomic_fetch_add_relaxed (&mapped->counter, -1) == 1)
__nscd_unmap (mapped);
mapped = NO_MAPPING;
}
if ((gc_cycle & 1) != 0 || ++nretries == 5 || retval == -1)
{
/* nscd is just running gc now. Disable using the mapping. */
- if (atomic_decrement_val (&mapped->counter) == 0)
+ if (atomic_fetch_add_relaxed (&mapped->counter, -1) == 1)
__nscd_unmap (mapped);
mapped = NO_MAPPING;
}