summaryrefslogtreecommitdiff
path: root/linuxthreads/spinlock.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-20 04:46:22 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-20 04:46:22 +0000
commitba80a015ee80c01be5100b8b94794b8784aa562b (patch)
tree7bb6db1e6fa726246c08346ce0732e393f174450 /linuxthreads/spinlock.h
parentea97f90c9a84ce5c8a7c60695f05adfd2b6bb295 (diff)
Update.
* malloc/Makefile: Change all references to memprof into memusage. * malloc/memprof.c: Rename to... * malloc/memusage.c: ...this. New file. * malloc/memprof.sh: Rename to... * malloc/memusage.sh: ...this. New file. * malloc/memprofstat.c: Rename to... * malloc/memusagestat.c: ...this. New file.
Diffstat (limited to 'linuxthreads/spinlock.h')
-rw-r--r--linuxthreads/spinlock.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/linuxthreads/spinlock.h b/linuxthreads/spinlock.h
index 96010e4636..d1da3c1094 100644
--- a/linuxthreads/spinlock.h
+++ b/linuxthreads/spinlock.h
@@ -12,6 +12,25 @@
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Library General Public License for more details. */
+
+/* There are 2 compare and swap synchronization primitives with
+ different semantics:
+
+ 1. compare_and_swap, which has acquire semantics (i.e. it
+ completes befor subsequent writes.)
+ 2. compare_and_swap_with_release_semantics, which has release
+ semantics (it completes after previous writes.)
+
+ For those platforms on which they are the same. HAS_COMPARE_AND_SWAP
+ should be defined. For those platforms on which they are different,
+ HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS has to be defined. */
+
+#ifndef HAS_COMPARE_AND_SWAP
+#ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
+#define HAS_COMPARE_AND_SWAP
+#endif
+#endif
+
#if defined(TEST_FOR_COMPARE_AND_SWAP)
extern int __pthread_has_cas;
@@ -29,6 +48,18 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval,
#elif defined(HAS_COMPARE_AND_SWAP)
+#ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
+
+static inline int
+compare_and_swap_with_release_semantics (long * ptr, long oldval,
+ long newval, int * spinlock)
+{
+ return __compare_and_swap_with_release_semantics (ptr, oldval,
+ newval);
+}
+
+#endif
+
static inline int compare_and_swap(long * ptr, long oldval, long newval,
int * spinlock)
{
@@ -48,6 +79,10 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval,
#endif
+#ifndef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
+#define compare_and_swap_with_release_semantics compare_and_swap
+#endif
+
/* Internal locks */
extern void internal_function __pthread_lock(struct _pthread_fastlock * lock,