freebsd-nq/libexec/rtld-elf
John Polstra e6f0183bff Remove the nanosleep calls from the spin loops in the locking code.
They provided little benefit (if any) and they caused some problems
in OpenOffice, at least in post-KSE -current and perhaps in other
environments too.  The nanosleep calls prevented the profiling timer
from advancing during the spinloops, thereby preventing the thread
scheduler from ever pre-empting the spinning thread.  Alexander
Kabaev diagnosed this problem, Martin Blapp helped with testing,
and Matt Dillon provided some helpful suggestions.

This is a short-term fix for a larger problem.  The use of spinlocking
isn't guaranteed to work in all cases.  For example, if the spinning
thread has higher priority than all other threads, it may never be
pre-empted, and the thread holding the lock may never progress far
enough to release the lock.  On the other hand, spinlocking is the
only locking that can work with an arbitrary unknown threads package.

I have some ideas for a much better fix in the longer term.  It
would eliminate all locking inside the dynamic linker by making it
safe for symbol lookups and lazy binding to proceed in parallel
with a call to dlopen or dlclose.  This means that the only mutual
exclusion needed would be to prevent multiple simultaneous calls
to dlopen and/or dlclose.  That mutual exclusion could be put into
the native pthreads library.  Applications using foreign threads
packages would have to make their own arrangements to ensure that
they did not have multiple threads in dlopen and/or dlclose -- a
reasonable requirement in my opinion.

MFC after:	3 days
2002-07-06 20:25:56 +00:00
..
alpha Remove the nanosleep calls from the spin loops in the locking code. 2002-07-06 20:25:56 +00:00
amd64 Remove the nanosleep calls from the spin loops in the locking code. 2002-07-06 20:25:56 +00:00
i386 Remove the nanosleep calls from the spin loops in the locking code. 2002-07-06 20:25:56 +00:00
ia64 Remove the nanosleep calls from the spin loops in the locking code. 2002-07-06 20:25:56 +00:00
sparc64 Remove the nanosleep calls from the spin loops in the locking code. 2002-07-06 20:25:56 +00:00
debug.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
debug.h Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. The 2001-07-26 11:02:39 +00:00
Makefile Dillon's recent commits to the dynamic linker without running them 2002-06-10 21:51:16 +00:00
malloc.c Change brk's prototype from char *brk(const char *) to int brk(const void *) 2002-01-24 12:11:31 +00:00
map_object.c Add ia64 support. Various adjustments were made to existing targets to 2001-10-15 18:48:42 +00:00
rtld.1 The .Nm utility 2002-07-06 19:19:48 +00:00
rtld.c Fix handling of weak references to undefined symbols on ia64: 2002-04-27 05:32:51 +00:00
rtld.h Update rtld for the "new" ia64 ABI. In the old toolchain, the 2001-10-29 10:10:10 +00:00
xmalloc.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00