aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-08-23 06:03:42 +0000
committerRoland McGrath <roland@gnu.org>2001-08-23 06:03:42 +0000
commitc12aa8015699d66a193c3c183b4f1d1a72bb92c1 (patch)
treea20c1864b74c8471aa7aaf675da180546b16c537 /linuxthreads
parent8179dcc10808cf2a515cf19d445789193a763ec4 (diff)
downloadglibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.zip
glibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.tar.gz
glibc-c12aa8015699d66a193c3c183b4f1d1a72bb92c1.tar.bz2
* sysdeps/generic/ldsodefs.h (_dl_load_lock): Declare it here with
__libc_lock_define_recursive. * elf/dl-open.c: Don't declare it here any more. * elf/dl-close.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-lookup.c (add_dependency): Use __libc_lock_lock_recursive and __libc_lock_unlock_recursive. * elf/dl-close.c (_dl_close): Likewise * elf/dl-iteratephdr.c (__dl_iterate_phdr): Likewise * elf/dl-open.c (_dl_open): Likewise * sysdeps/generic/bits/libc-lock.h (__libc_lock_define_recursive): New macro. * sysdeps/generic/bits/stdio-lock.h (_IO_lock_t): Use it. (_IO_lock_lock): Use __libc_lock_lock_recursive. (_IO_lock_unlock): Use __libc_lock_unlock_recursive.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog18
-rw-r--r--linuxthreads/sysdeps/pthread/bits/libc-lock.h18
-rw-r--r--linuxthreads/sysdeps/pthread/bits/stdio-lock.h19
3 files changed, 37 insertions, 18 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index a3c0f77..fcb2e07 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,21 @@
+2001-08-22 Roland McGrath <roland@frob.com>
+
+ * sysdeps/pthread/bits/stdio-lock.h: Include <bits/libc-lock.h>
+ instead of <pthread.h>.
+ (_IO_lock_t): Define this typedef using __libc_lock_define_recursive.
+ (_IO_lock_initializer): Add braces.
+ (_IO_lock_lock): Use __libc_lock_lock_recursive.
+ (_IO_lock_unlock): Use __libc_lock_unlock_recursive.
+
+ * sysdeps/pthread/bits/libc-lock.h (__libc_lock_recursive_t): New type.
+ (__libc_lock_define_initialized_recursive): Use it.
+ (__libc_lock_init_recursive): Likewise.
+ (__libc_lock_fini_recursive): Likewise.
+ (__libc_lock_lock_recursive): Likewise.
+ (__libc_lock_trylock_recursive): Likewise.
+ (__libc_lock_unlock_recursive): Likewise.
+ (__libc_lock_define_recursive): New macro.
+
2001-08-14 Jakub Jelinek <jakub@redhat.com>
* lockfile.c (__pthread_provide_lockfile): New variable.
diff --git a/linuxthreads/sysdeps/pthread/bits/libc-lock.h b/linuxthreads/sysdeps/pthread/bits/libc-lock.h
index dbd9cc1..fc68979 100644
--- a/linuxthreads/sysdeps/pthread/bits/libc-lock.h
+++ b/linuxthreads/sysdeps/pthread/bits/libc-lock.h
@@ -26,8 +26,10 @@
#ifdef _LIBC
typedef pthread_mutex_t __libc_lock_t;
typedef pthread_rwlock_t __libc_rwlock_t;
+typedef struct { pthread_mutex_t mutex; } __libc_lock_recursive_t;
#else
typedef struct __libc_lock_opaque__ __libc_lock_t;
+typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
typedef struct __libc_rwlock_opaque__ __libc_rwlock_t;
#endif
@@ -45,6 +47,8 @@ typedef pthread_key_t __libc_key_t;
CLASS __libc_lock_t NAME;
#define __libc_rwlock_define(CLASS,NAME) \
CLASS __libc_rwlock_t NAME;
+#define __libc_lock_define_recursive(CLASS,NAME) \
+ CLASS __libc_lock_recursive_t NAME;
/* Define an initialized lock variable NAME with storage class CLASS.
@@ -68,8 +72,8 @@ typedef pthread_key_t __libc_key_t;
/* Define an initialized recursive lock variable NAME with storage
class CLASS. */
-#define __libc_lock_define_initialized_recursive(CLASS,NAME) \
- CLASS __libc_lock_t NAME = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+#define __libc_lock_define_initialized_recursive(CLS,NAME) \
+ CLS __libc_lock_recursive_t NAME = {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP};
/* Initialize the named lock variable, leaving it in a consistent, unlocked
state. */
@@ -86,7 +90,7 @@ typedef pthread_key_t __libc_key_t;
pthread_mutexattr_t __attr; \
__pthread_mutexattr_init (&__attr); \
__pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \
- __pthread_mutex_init (&(NAME), &__attr); \
+ __pthread_mutex_init (&(NAME).mutex, &__attr); \
__pthread_mutexattr_destroy (&__attr); \
} \
} while (0);
@@ -100,7 +104,7 @@ typedef pthread_key_t __libc_key_t;
(__pthread_rwlock_destroy != NULL ? __pthread_rwlock_destroy (&(NAME)) : 0);
/* Finalize recursive named lock. */
-#define __libc_lock_fini_recursive(NAME) __libc_lock_fini (NAME)
+#define __libc_lock_fini_recursive(NAME) __libc_lock_fini ((NAME).mutex)
/* Lock the named lock variable. */
#define __libc_lock_lock(NAME) \
@@ -111,7 +115,7 @@ typedef pthread_key_t __libc_key_t;
(__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)
+#define __libc_lock_lock_recursive(NAME) __libc_lock_lock ((NAME).mutex)
/* Try to lock the named lock variable. */
#define __libc_lock_trylock(NAME) \
@@ -124,7 +128,7 @@ typedef pthread_key_t __libc_key_t;
? __pthread_rwlock_trywrlock (&(NAME)) : 0)
/* Try to lock the recursive named lock variable. */
-#define __libc_lock_trylock_recursive(NAME) __libc_lock_trylock (NAME)
+#define __libc_lock_trylock_recursive(NAME) __libc_lock_trylock ((NAME).mutex)
/* Unlock the named lock variable. */
#define __libc_lock_unlock(NAME) \
@@ -133,7 +137,7 @@ typedef pthread_key_t __libc_key_t;
(__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)
+#define __libc_lock_unlock_recursive(NAME) __libc_lock_unlock ((NAME).mutex)
/* Define once control variable. */
diff --git a/linuxthreads/sysdeps/pthread/bits/stdio-lock.h b/linuxthreads/sysdeps/pthread/bits/stdio-lock.h
index a1893c8..4dc7dcf 100644
--- a/linuxthreads/sysdeps/pthread/bits/stdio-lock.h
+++ b/linuxthreads/sysdeps/pthread/bits/stdio-lock.h
@@ -17,12 +17,17 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <pthread.h>
+#include <bits/libc-lock.h>
-typedef pthread_mutex_t _IO_lock_t;
+__libc_lock_define_recursive (typedef, _IO_lock_t)
/* We need recursive (counting) mutexes. */
-#define _IO_lock_initializer PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#define _IO_lock_initializer {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP}
+
+#define _IO_lock_init(_name) __libc_lock_init_recursive (_name)
+#define _IO_lock_fini(_name) __libc_lock_fini_recursive (_name)
+#define _IO_lock_lock(_name) __libc_lock_lock_recursive (_name)
+#define _IO_lock_unlock(_name) __libc_lock_unlock_recursive (_name)
#define _IO_cleanup_region_start(_fct, _fp) \
@@ -40,11 +45,3 @@ typedef pthread_mutex_t _IO_lock_t;
}
#define _IO_cleanup_region_end(_doit) \
__libc_cleanup_region_end (_doit)
-#define _IO_lock_init(_name) \
- __libc_lock_init_recursive (_name)
-#define _IO_lock_fini(_name) \
- __libc_lock_fini_recursive (_name)
-#define _IO_lock_lock(_name) \
- __libc_lock_lock (_name)
-#define _IO_lock_unlock(_name) \
- __libc_lock_unlock (_name)