From 9f835f5fb48eb6e173a7ca3c678595dba28c5e7a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 12 Jul 2000 20:06:44 +0000 Subject: Update. 2000-07-12 Bruno Haible * iconv/gconv_open.c (__gconv_open): Merge duplicated code. 2000-07-12 Bruno Haible * iconv/gconv_builtin.c (__gconv_get_builtin_trans): Initialize __modname. 2000-07-12 Bruno Haible * iconv/gconv_open.c (__gconv_open): Initialize result->__steps[cnt].__data. 2000-07-12 Mark Kettenis * nss/getent.c (services_keys): Pass port number in network byte order in call to getservbyport. 2000-07-11 Andreas Jaeger * 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 * Makeconfig (run-program-prefix): New rule. (built-program-cmd): Use run-program-prefix. --- linuxthreads/spinlock.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'linuxthreads/spinlock.h') 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 */ -- cgit 1.4.1