From d6c7294ed609cbd8597898a1c92141dde23994bc Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 20 Aug 2005 01:22:05 +0000 Subject: * sysdeps/ia64/fpu/libm_error.c (__libm_error_support): Don't abort. 2005-08-17 Robert Love * sysdeps/unix/sysv/linux/sys/inotify.h: Add IN_MOVE_SELF event. 2005-08-19 Bruno Haible * intl/localealias.c (read_alias_file): In case of failure, close the file descriptor and sort the array before returning. 2005-08-19 Ulrich Drepper * malloc/Makefile: Link libmemusage.so with ld.so. * malloc/memusage.c: Use atomic operations for all counter and size computations. Handle thread stacks. * sysdeps/generic/memusage.h: Define memusage_cntr_t and memusage_size_t. * sysdeps/i386/i686/memusage.h: New file. * include/atomic.h: Define atomic_max and atomic_min. * debug/tst-chk1.c: Add tests for mbstowcs and wcstombs. --- include/atomic.h | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'include/atomic.h') diff --git a/include/atomic.h b/include/atomic.h index 8a23f6ee9e..8b76435a81 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -1,5 +1,5 @@ /* Internal macros for atomic operations for GNU C Library. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -108,7 +108,7 @@ __typeof (*(mem)) __value = (newvalue); \ \ do \ - __oldval = (*__memp); \ + __oldval = *__memp; \ while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \ __value, \ __oldval),\ @@ -130,7 +130,7 @@ __typeof (*(mem)) __value = (value); \ \ do \ - __oldval = (*__memp); \ + __oldval = *__memp; \ while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \ __oldval \ + __value,\ @@ -141,6 +141,41 @@ #endif + +#ifndef atomic_max +# define atomic_max(mem, value) \ + do { \ + __typeof (*(mem)) __oldval; \ + __typeof (mem) __memp = (mem); \ + __typeof (*(mem)) __value = (value); \ + do { \ + __oldval = *__memp; \ + if (__oldval >= __value) \ + break; \ + } while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \ + __value, \ + __oldval),\ + 0)); \ + } while (0) +#endif + +#ifndef atomic_min +# define atomic_min(mem, value) \ + do { \ + __typeof (*(mem)) __oldval; \ + __typeof (mem) __memp = (mem); \ + __typeof (*(mem)) __value = (value); \ + do { \ + __oldval = *__memp; \ + if (__oldval <= __value) \ + break; \ + } while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \ + __value, \ + __oldval),\ + 0)); \ + } while (0) +#endif + #ifndef atomic_add # define atomic_add(mem, value) (void) atomic_exchange_and_add ((mem), (value)) #endif -- cgit 1.4.1