diff options
Diffstat (limited to 'linuxthreads')
-rw-r--r-- | linuxthreads/ChangeLog | 11 | ||||
-rw-r--r-- | linuxthreads/Versions | 5 | ||||
-rw-r--r-- | linuxthreads/rwlock.c | 26 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/bits/libc-lock.h | 52 |
4 files changed, 82 insertions, 12 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 9fcbf92ed2..1179e7f8bf 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,8 +1,15 @@ +2000-02-27 Ulrich Drepper <drepper@redhat.com> + + * rwlock.c: Define __* variants of the functions and make old names + aliases. + * Versions [GLIBC_2.2]: Export the __pthread_rwlock_* functions. + * sysdeps/pthread/bits/libc-lock.h: Define __libc_rwlock_* macros. + 2000-02-25 Andreas Jaeger <aj@suse.de> * Versions: Export pread, __pread64, pread64, pwrite, __pwrite64, - pwrite64, lseek64, open64, and __open64 with version 2.2. - + pwrite64, lseek64, open64, and __open64 with version 2.2. + 2000-02-22 Ulrich Drepper <drepper@redhat.com> * semaphore.h (SEM_FAILED): Use 0 not NULL. diff --git a/linuxthreads/Versions b/linuxthreads/Versions index 1e93064f41..1b9de67b67 100644 --- a/linuxthreads/Versions +++ b/linuxthreads/Versions @@ -124,5 +124,10 @@ libpthread { open64; __open64; __res_state; + + # Names used internally. + __pthread_rwlock_init; __pthread_rwlock_destroy; __pthread_rwlock_rdlock; + __pthread_rwlock_tryrdlock; __pthread_rwlock_wrlock; + __pthread_rwlock_trywrlock; __pthread_rwlock_unlock; } } diff --git a/linuxthreads/rwlock.c b/linuxthreads/rwlock.c index e1401c3c0c..0dd714bc39 100644 --- a/linuxthreads/rwlock.c +++ b/linuxthreads/rwlock.c @@ -183,7 +183,7 @@ rwlock_have_already(pthread_descr *pself, pthread_rwlock_t *rwlock, } int -pthread_rwlock_init (pthread_rwlock_t *rwlock, +__pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) { __pthread_init_lock(&rwlock->__rw_lock); @@ -205,10 +205,11 @@ pthread_rwlock_init (pthread_rwlock_t *rwlock, return 0; } +strong_alias (__pthread_init_lock, pthread_init_lock) int -pthread_rwlock_destroy (pthread_rwlock_t *rwlock) +__pthread_rwlock_destroy (pthread_rwlock_t *rwlock) { int readers; _pthread_descr writer; @@ -223,16 +224,17 @@ pthread_rwlock_destroy (pthread_rwlock_t *rwlock) return 0; } +strong_alias (__pthread_rwlock_destroy, pthread_rwlock_destroy) int -pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) +__pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) { pthread_descr self = NULL; pthread_readlock_info *existing; int out_of_mem, have_lock_already; have_lock_already = rwlock_have_already(&self, rwlock, - &existing, &out_of_mem); + &existing, &out_of_mem); for (;;) { @@ -262,9 +264,10 @@ pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) return 0; } +strong_alias (__pthread_rwlock_rdlock, pthread_rwlock_rdlock) int -pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock) +__pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock) { pthread_descr self = thread_self(); pthread_readlock_info *existing; @@ -303,10 +306,11 @@ pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock) return retval; } +strong_alias (__pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock) int -pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) +__pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) { pthread_descr self = thread_self (); @@ -326,10 +330,11 @@ pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) suspend (self); /* This is not a cancellation point */ } } +strong_alias (__pthread_rwlock_wrlock, pthread_rwlock_wrlock) int -pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) +__pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) { int result = EBUSY; @@ -343,10 +348,11 @@ pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) return result; } +strong_alias (__pthread_rwlock_trywrlock, pthread_rwlock_trywrlock) int -pthread_rwlock_unlock (pthread_rwlock_t *rwlock) +__pthread_rwlock_unlock (pthread_rwlock_t *rwlock) { pthread_descr torestart; pthread_descr th; @@ -425,6 +431,7 @@ pthread_rwlock_unlock (pthread_rwlock_t *rwlock) return 0; } +strong_alias (__pthread_rwlock_unlock, pthread_rwlock_unlock) @@ -439,10 +446,11 @@ pthread_rwlockattr_init (pthread_rwlockattr_t *attr) int -pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr) +__pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr) { return 0; } +strong_alias (__pthread_rwlockattr_destroy, pthread_rwlockattr_destroy) int diff --git a/linuxthreads/sysdeps/pthread/bits/libc-lock.h b/linuxthreads/sysdeps/pthread/bits/libc-lock.h index 0f412bb9e2..76a56d5058 100644 --- a/linuxthreads/sysdeps/pthread/bits/libc-lock.h +++ b/linuxthreads/sysdeps/pthread/bits/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. LinuxThreads version. - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2000 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 @@ -25,8 +25,10 @@ /* Mutex type. */ #ifdef _LIBC typedef pthread_mutex_t __libc_lock_t; +typedef pthread_rwlock_t __libc_rwlock_t; #else typedef struct __libc_lock_opaque__ __libc_lock_t; +typedef struct __libc_rwlock_opaque__ __libc_rwlock_t; #endif /* Type for key to thread-specific data. */ @@ -41,6 +43,8 @@ typedef pthread_key_t __libc_key_t; of libc. */ #define __libc_lock_define(CLASS,NAME) \ CLASS __libc_lock_t NAME; +#define __libc_rwlock_define(CLASS,NAME) \ + CLASS __libc_rwlock_t NAME; /* Define an initialized lock variable NAME with storage class CLASS. @@ -50,6 +54,8 @@ typedef pthread_key_t __libc_key_t; section. */ #define __libc_lock_define_initialized(CLASS,NAME) \ CLASS __libc_lock_t NAME; +#define __libc_rwlock_define_initialized(CLASS,NAME) \ + CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER; /* Define an initialized recursive lock variable NAME with storage class CLASS. */ @@ -60,6 +66,8 @@ typedef pthread_key_t __libc_key_t; state. */ #define __libc_lock_init(NAME) \ (__pthread_mutex_init != NULL ? __pthread_mutex_init (&(NAME), NULL) : 0); +#define __libc_rwlock_init(NAME) \ + (__pthread_rwlock_init != NULL ? __pthread_rwlock_init (&(NAME), NULL) : 0); /* Same as last but this time we initialize a recursive mutex. */ #define __libc_lock_init_recursive(NAME) \ @@ -79,6 +87,8 @@ typedef pthread_key_t __libc_key_t; called on a lock variable before the containing storage is reused. */ #define __libc_lock_fini(NAME) \ (__pthread_mutex_destroy != NULL ? __pthread_mutex_destroy (&(NAME)) : 0); +#define __libc_rwlock_fini(NAME) \ + (__pthread_rwlock_destroy != NULL ? __pthread_rwlock_destroy (&(NAME)) : 0); /* Finalize recursive named lock. */ #define __libc_lock_fini_recursive(NAME) __libc_lock_fini (NAME) @@ -86,6 +96,10 @@ typedef pthread_key_t __libc_key_t; /* Lock the named lock variable. */ #define __libc_lock_lock(NAME) \ (__pthread_mutex_lock != NULL ? __pthread_mutex_lock (&(NAME)) : 0); +#define __libc_rwlock_rdlock(NAME) \ + (__pthread_rwlock_rdlock != NULL ? __pthread_rwlock_rdlock (&(NAME)) : 0); +#define __libc_rwlock_wrlock(NAME) \ + (__pthread_rwlock_wrlock != NULL ? __pthread_rwlock_wrlock (&(NAME)) : 0); /* Lock the recursive named lock variable. */ #define __libc_lock_lock_recursive(NAME) __libc_lock_lock (NAME) @@ -93,6 +107,12 @@ typedef pthread_key_t __libc_key_t; /* Try to lock the named lock variable. */ #define __libc_lock_trylock(NAME) \ (__pthread_mutex_trylock != NULL ? __pthread_mutex_trylock (&(NAME)) : 0) +#define __libc_rwlock_tryrdlock(NAME) \ + (__pthread_rwlock_tryrdlock != NULL \ + ? __pthread_rwlock_tryrdlock (&(NAME)) : 0) +#define __libc_rwlock_trywrlock(NAME) \ + (__pthread_rwlock_trywrlock != NULL \ + ? __pthread_rwlock_trywrlock (&(NAME)) : 0) /* Try to lock the recursive named lock variable. */ #define __libc_lock_trylock_recursive(NAME) __libc_lock_trylock (NAME) @@ -100,6 +120,8 @@ typedef pthread_key_t __libc_key_t; /* Unlock the named lock variable. */ #define __libc_lock_unlock(NAME) \ (__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (&(NAME)) : 0); +#define __libc_rwlock_unlock(NAME) \ + (__pthread_rwlock_unlock != NULL ? __pthread_rwlock_unlock (&(NAME)) : 0); /* Unlock the recursive named lock variable. */ #define __libc_lock_unlock_recursive(NAME) __libc_lock_unlock (NAME) @@ -187,6 +209,21 @@ extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind); +extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock, + __const pthread_rwlockattr_t *__attr); + +extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); + +extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); + extern int __pthread_key_create (pthread_key_t *__key, void (*__destr_function) (void *)); @@ -216,6 +253,13 @@ weak_extern (__pthread_mutex_unlock) weak_extern (__pthread_mutexattr_init) weak_extern (__pthread_mutexattr_destroy) weak_extern (__pthread_mutexattr_settype) +weak_extern (__pthread_rwlock_init) +weak_extern (__pthread_rwlock_destroy) +weak_extern (__pthread_rwlock_rdlock) +weak_extern (__pthread_rwlock_tryrdlock) +weak_extern (__pthread_rwlock_wrlock) +weak_extern (__pthread_rwlock_trywrlock) +weak_extern (__pthread_rwlock_unlock) weak_extern (__pthread_key_create) weak_extern (__pthread_setspecific) weak_extern (__pthread_getspecific) @@ -233,6 +277,12 @@ weak_extern (_pthread_cleanup_pop_restore) # pragma weak __pthread_mutexattr_init # pragma weak __pthread_mutexattr_destroy # pragma weak __pthread_mutexattr_settype +# pragna weak __pthread_rwlock_destroy +# pragma weak __pthread_rwlock_rdlock +# pragma weak __pthread_rwlock_tryrdlock +# pragma weak __pthread_rwlock_wrlock +# pragma weak __pthread_rwlock_trywrlock +# pragma weak __pthread_rwlock_unlock # pragma weak __pthread_key_create # pragma weak __pthread_setspecific # pragma weak __pthread_getspecific |