aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-08-20 01:22:05 +0000
committerUlrich Drepper <drepper@redhat.com>2005-08-20 01:22:05 +0000
commitd6c7294ed609cbd8597898a1c92141dde23994bc (patch)
treeb2077c19a57c2df853ef6f9ade3fb88d4d2534a4 /include
parent2a81f17880ff4d75cc6ef3fd4456cc23f28a6ed3 (diff)
downloadglibc-d6c7294ed609cbd8597898a1c92141dde23994bc.zip
glibc-d6c7294ed609cbd8597898a1c92141dde23994bc.tar.gz
glibc-d6c7294ed609cbd8597898a1c92141dde23994bc.tar.bz2
* sysdeps/ia64/fpu/libm_error.c (__libm_error_support): Don't abort.
2005-08-17 Robert Love <rml@novell.com> * sysdeps/unix/sysv/linux/sys/inotify.h: Add IN_MOVE_SELF event. 2005-08-19 Bruno Haible <bruno@clisp.org> * 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 <drepper@redhat.com> * 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.
Diffstat (limited to 'include')
-rw-r--r--include/atomic.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/include/atomic.h b/include/atomic.h
index 8a23f6e..8b76435 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 <drepper@redhat.com>, 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