1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
2002-01-30  Ulrich Drepper  <drepper@redhat.com>

	* Versions.def [ld]: Add GLIBC_2.3.
	* elf/dl-addr.c: Move global variables for SHARED code in struct
	_rtld_global.  Export this struct, remove all exports for the
	signal variables.
	* elf/dl-close.c: Likewise.
	* elf/dl-conflict.c: Likewise.
	* elf/dl-debug.c: Likewise.
	* elf/dl-deps.c: Likewise.
	* elf/dl-dst.h: Likewise.
	* elf/dl-error.c: Likewise.
	* elf/dl-fini.c: Likewise.
	* elf/dl-init.c: Likewise.
	* elf/dl-iteratephdr.c: Likewise.
	* elf/dl-libc.c: Likewise.
	* elf/dl-load.c: Likewise.
	* elf/dl-lookup.c: Likewise.
	* elf/dl-minimal.c: Likewise.
	* elf/dl-object.c: Likewise.
	* elf/dl-open.c: Likewise.
	* elf/dl-profile.c: Likewise.
	* elf/dl-profstub.c: Likewise.
	* elf/dl-reloc.c: Likewise.
	* elf/dl-runtime.c: Likewise.
	* elf/dl-support.c: Likewise.
	* elf/dl-sym.c: Likewise.
	* elf/dl-version.c: Likewise.
	* elf/do-lookup.h: Likewise.
	* elf/do-rel.h: Likewise.
	* elf/dynamic-link.h: Likewise.
	* elf/rtld.c: Likewise.
	* sysdeps/generic/dl-cache.c: Likewise.
	* sysdeps/generic/dl-sysdep.c: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.
	* sysdeps/generic/libc-start.c: Likewise.
	* sysdeps/i386/dl-machine.h: Likewise.
	* sysdeps/ia64/dl-fptr.c: Likewise.
	* sysdeps/ia64/dl-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/dl-librecon.h: Likewise.
	* sysdeps/unix/sysv/linux/dl-origin.c: Likewise.
	* sysdeps/unix/sysv/linux/dl-osinfo.h: Likewise.
	* sysdeps/unix/sysv/linux/getclktck.c: Likewise.
	* sysdeps/unix/sysv/linux/getpagesize.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/dl-static.c: Likewise.
	* sysdeps/unix/sysv/linux/ia64/getpagesize.c: Likewise.

	* malloc/thread-m.h: Spinlock definitions for x86/x86_64.
This commit is contained in:
Ulrich Drepper
2002-01-31 03:41:25 +00:00
parent 1b4575aefa
commit d6b5d570a3
46 changed files with 678 additions and 571 deletions

View File

@ -1,8 +1,8 @@
/* Basic platform-independent macro definitions for mutexes and
thread-specific data.
Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>, 1996.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -117,6 +117,61 @@ __libc_tsd_define (, MALLOC) /* declaration/common definition */
typedef pthread_t thread_id;
/* mutex */
#if (defined __i386__ || defined __x86_64__) && defined __GNUC__ && \
!defined USE_NO_SPINLOCKS
#include <time.h>
/* Use fast inline spinlocks. */
typedef struct {
volatile unsigned int lock;
int pad0_;
} mutex_t;
#define MUTEX_INITIALIZER { 0 }
#define mutex_init(m) ((m)->lock = 0)
static inline int mutex_lock(mutex_t *m) {
int cnt = 0, r;
struct timespec tm;
for(;;) {
__asm__ __volatile__
("xchgl %0, %1"
: "=r"(r), "=m"(m->lock)
: "0"(1), "m"(m->lock)
: "memory");
if(!r)
return 0;
if(cnt < 50) {
sched_yield();
cnt++;
} else {
tm.tv_sec = 0;
tm.tv_nsec = 2000001;
nanosleep(&tm, NULL);
cnt = 0;
}
}
}
static inline int mutex_trylock(mutex_t *m) {
int r;
__asm__ __volatile__
("xchgl %0, %1"
: "=r"(r), "=m"(m->lock)
: "0"(1), "m"(m->lock)
: "memory");
return r;
}
static inline int mutex_unlock(mutex_t *m) {
m->lock = 0;
__asm __volatile ("" : "=m" (m->lock) : "0" (m->lock));
return 0;
}
#else
/* Normal pthread mutex. */
typedef pthread_mutex_t mutex_t;
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
@ -125,6 +180,8 @@ typedef pthread_mutex_t mutex_t;
#define mutex_trylock(m) pthread_mutex_trylock(m)
#define mutex_unlock(m) pthread_mutex_unlock(m)
#endif /* (__i386__ || __x86_64__) && __GNUC__ && !USE_NO_SPINLOCKS */
/* thread specific data */
#if defined(__sgi) || defined(USE_TSD_DATA_HACK)