diff options
author | Roland McGrath <roland@gnu.org> | 2001-04-01 05:02:48 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2001-04-01 05:02:48 +0000 |
commit | 24cf21d780e14d5a7e04257afdf67f6c7ca90f83 (patch) | |
tree | 277ca2abec573039e281975a97fe1fd9123f8719 /sysdeps/generic/atomicity.h | |
parent | 2e3f5f597947d07831f3104ba3753153de5346a2 (diff) | |
download | glibc-24cf21d780e14d5a7e04257afdf67f6c7ca90f83.tar.gz glibc-24cf21d780e14d5a7e04257afdf67f6c7ca90f83.tar.xz glibc-24cf21d780e14d5a7e04257afdf67f6c7ca90f83.zip |
2001-03-11 Roland McGrath <roland@frob.com>
* sysdeps/generic/atomicity.h (exchange_and_add, atomic_add, compare_and_swap): Add volatile qualifier to first arg, to bring these prototypes in line with all the other implementations. Add a #warning to remind the builder that these are not atomic.
Diffstat (limited to 'sysdeps/generic/atomicity.h')
-rw-r--r-- | sysdeps/generic/atomicity.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sysdeps/generic/atomicity.h b/sysdeps/generic/atomicity.h index 887ce73384..28107def39 100644 --- a/sysdeps/generic/atomicity.h +++ b/sysdeps/generic/atomicity.h @@ -1,5 +1,5 @@ /* Low-level functions for atomic operations. Stub version. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,10 +22,11 @@ #include <inttypes.h> +#warning stub atomicity functions are not atomic static inline int __attribute__ ((unused)) -exchange_and_add (uint32_t *mem, int val) +exchange_and_add (volatile uint32_t *mem, int val) { int result = *mem; *mem += val; @@ -34,14 +35,14 @@ exchange_and_add (uint32_t *mem, int val) static inline void __attribute__ ((unused)) -atomic_add (uint32_t *mem, int val) +atomic_add (volatile uint32_t *mem, int val) { *mem += val; } static inline int __attribute__ ((unused)) -compare_and_swap (long int *p, long int oldval, long int newval) +compare_and_swap (volatile long int *p, long int oldval, long int newval) { if (*p != oldval) return 0; |