about summary refs log tree commit diff
path: root/linuxthreads/spinlock.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-12 20:06:44 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-12 20:06:44 +0000
commit9f835f5fb48eb6e173a7ca3c678595dba28c5e7a (patch)
tree34f261d68fe97fc358f706dc8883ecfdfd450caf /linuxthreads/spinlock.h
parent50a6564365575ba9d20a6cfde261ec5fcbb9ff35 (diff)
downloadglibc-9f835f5fb48eb6e173a7ca3c678595dba28c5e7a.tar.gz
glibc-9f835f5fb48eb6e173a7ca3c678595dba28c5e7a.tar.xz
glibc-9f835f5fb48eb6e173a7ca3c678595dba28c5e7a.zip
Update.
2000-07-12  Bruno Haible  <haible@clisp.cons.org>

	* iconv/gconv_open.c (__gconv_open): Merge duplicated code.

2000-07-12  Bruno Haible  <haible@clisp.cons.org>

	* iconv/gconv_builtin.c (__gconv_get_builtin_trans): Initialize
	__modname.

2000-07-12  Bruno Haible  <haible@clisp.cons.org>

	* iconv/gconv_open.c (__gconv_open): Initialize
	result->__steps[cnt].__data.

2000-07-12  Mark Kettenis  <kettenis@gnu.org>

	* nss/getent.c (services_keys): Pass port number in network byte
	order in call to getservbyport.

2000-07-11  Andreas Jaeger  <aj@suse.de>

	* stdlib/Makefile (test-canon-ARGS): Fix for building in the
	source dir.
	* intl/Makefile (do-gettext-test): Likewise.
	* dirent/Makefile (opendir-tst1-ARGS): Likewise.

2000-07-11  Andreas Schwab  <schwab@suse.de>

	* Makeconfig (run-program-prefix): New rule.
	(built-program-cmd): Use run-program-prefix.
Diffstat (limited to 'linuxthreads/spinlock.h')
-rw-r--r--linuxthreads/spinlock.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/linuxthreads/spinlock.h b/linuxthreads/spinlock.h
index 6609ef71c9..435271d812 100644
--- a/linuxthreads/spinlock.h
+++ b/linuxthreads/spinlock.h
@@ -105,7 +105,7 @@ static inline int __pthread_trylock (struct _pthread_fastlock * lock)
 #if defined TEST_FOR_COMPARE_AND_SWAP
   if (!__pthread_has_cas)
 #endif
-#if !defined HAS_COMPARE_AND_SWAP
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
   {
     return (testandset(&lock->__spinlock) ? EBUSY : 0);
   }
@@ -140,13 +140,26 @@ static inline void __pthread_alt_init_lock(struct _pthread_fastlock * lock)
 
 static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock)
 {
+#if defined HAS_COMPARE_AND_SWAP
   long oldstatus;
+#endif
+
+#if defined TEST_FOR_COMPARE_AND_SWAP
+  if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  {
+    return (testandset(&lock->__spinlock) ? EBUSY : 0);
+  }
+#endif
 
+#if defined HAS_COMPARE_AND_SWAP
   do {
     oldstatus = lock->__status;
     if (oldstatus != 0) return EBUSY;
   } while(! compare_and_swap(&lock->__status, 0, 1, &lock->__spinlock));
   return 0;
+#endif
 }
 
 /* Initializers for both lock variants */