Up to [cvs.NetBSD.org] / src / lib / libpthread
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
libpthread: Move namespacing include to top of .c files. Stuff like libc's namespace.h, or atomic_op_namespace.h, which does namespacing tricks like `#define atomic_cas_uint _atomic_cas_uint', has to go at the top of each .c file. If it goes in the middle, it might be too late to affect the declarations, and result in compile errors. I tripped over this by including <sys/atomic.h> in mips <machine/lock.h>. (Maybe we should create a new pthread_namespace.h file for the purpose, but this'll do for now.)
- Try to eliminate a hang in "parked" I've been seeing while stress testing. Centralise wakeup of deferred waiters in pthread__clear_waiters() and use throughout libpthread. Make fewer assumptions. Be more conservative in pthread_mutex when dealing with pending waiters. - Remove the "hint" argument everywhere since the kernel doesn't use it any more.
Merge changes from current as of 20200406
Use pthread_barrierattr_t and pthread_barrier_t magic fields Set respectively _PT_BARRIER_DEAD for pthread_barrier_destroy() and _PT_BARRIERATTR_DEAD for pthread_barrierattr_destroy(). Validate _PT_BARRIER_MAGIC in pthread_barrier_t and _PT_BARRIERATTR_MAGIC in pthread_barrierattr_t accordingly.
GSoC 2016 Charles Cui: Implement thread priority protection based on work by Andy Doran. Also document the get/set pshared thread calls as not implemented, and add a skeleton implementation that is disabled. XXX: document _sched_protect(2).
Pull up following revision(s) (requested by ad in ticket #379): lib/libpthread/pthread_barrier.c: revision 1.19 pthread_barrier: Fix numerous stupid bugs. Surprising that nobody complained yet.
pthread_barrier: Fix numerous stupid bugs. Surprising that nobody complained yet.
Sync with the following revisions (requested by skrll in ticket #1196): gnu/dist/gdb removed gnu/usr.bin/gdb53 removed distrib/cats/instkernel/Makefile 1.14.6.1 gnu/dist/gdb6/bfd/config.bfd 1.3.6.1 gnu/dist/gdb6/bfd/elfxx-sparc.c 1.1.1.2.6.1 gnu/dist/gdb6/bfd/elfxx-sparc.h 1.1.1.2.6.1 gnu/dist/gdb6/gdb/Makefile.in 1.2.2.1.2.2 gnu/dist/gdb6/gdb/alpha-tdep.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/alpha-tdep.h 1.1.1.2.6.1 gnu/dist/gdb6/gdb/alphabsd-nat.c 1.1.1.2.6.2 gnu/dist/gdb6/gdb/alphabsd-nat.h 1.1.2.1 gnu/dist/gdb6/gdb/alphabsd-tdep.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/alphabsd-tdep.h 1.1.1.2.6.1 gnu/dist/gdb6/gdb/alphanbsd-nat.c 1.1.2.1 gnu/dist/gdb6/gdb/alphanbsd-tdep.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/amd64-nat.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/amd64bsd-nat.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/amd64nbsd-nat.c 1.1.1.2.6.3 gnu/dist/gdb6/gdb/amd64nbsd-tdep.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/arm-tdep.h 1.1.1.2.6.1 gnu/dist/gdb6/gdb/armbsd-tdep.c 1.1.2.1 gnu/dist/gdb6/gdb/armnbsd-nat.c 1.1.1.2.6.2 gnu/dist/gdb6/gdb/armnbsd-tdep.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/configure 1.1.1.2.6.1 gnu/dist/gdb6/gdb/configure.ac 1.1.1.2.6.1 gnu/dist/gdb6/gdb/i386bsd-nat.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/i386nbsd-tdep.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/m68kbsd-nat.c 1.1.1.2.6.2 gnu/dist/gdb6/gdb/mipsnbsd-nat.c 1.1.1.2.6.2 gnu/dist/gdb6/gdb/nbsd-thread.c 1.1.2.3 gnu/dist/gdb6/gdb/ppcnbsd-nat.c 1.1.1.2.6.2 gnu/dist/gdb6/gdb/ppcnbsd-tdep.c 1.3.6.1 gnu/dist/gdb6/gdb/sh-tdep.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/shnbsd-nat.c 1.1.1.2.6.3 gnu/dist/gdb6/gdb/shnbsd-tdep.c 1.1.1.2.6.4 gnu/dist/gdb6/gdb/shnbsd-tdep.h 1.1.1.2.6.1 gnu/dist/gdb6/gdb/sparc-nat.c 1.1.1.2.6.1 gnu/dist/gdb6/gdb/sparc64nbsd-nat.c 1.1.1.2.6.2 gnu/dist/gdb6/gdb/sparcnbsd-nat.c 1.1.1.2.6.2 gnu/dist/gdb6/gdb/tramp-frame.h 1.1.1.2.6.1 gnu/dist/gdb6/gdb/vaxbsd-nat.c 1.1.1.2.6.2 gnu/dist/gdb6/gdb/config/alpha/nbsd.mh 1.1.1.2.6.1 gnu/dist/gdb6/gdb/config/arm/nbsd.mt 1.1.1.1.6.1 gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh 1.1.1.1.6.1 gnu/dist/gdb6/gdb/config/i386/nbsd64.mh 1.1.1.1.6.1 gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh 1.1.1.1.6.1 gnu/dist/gdb6/gdb/config/mips/nbsd.mh 1.1.1.1.6.1 gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh 1.1.1.2.6.1 gnu/dist/gdb6/gdb/config/sh/nbsd.mh 1.1.1.1.6.2 gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h 1.1.1.1.6.1 gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh 1.1.1.1.6.1 gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh 1.1.1.1.6.1 gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh 1.1.1.1.6.1 gnu/dist/gdb6/opcodes/configure 1.1.1.2.6.1 gnu/dist/gdb6/opcodes/configure.in 1.1.1.2.6.1 gnu/usr.bin/Makefile 1.126.4.1 gnu/usr.bin/gdb6/arch/alpha/config.h 1.3.4.1 gnu/usr.bin/gdb6/arch/alpha/defs.mk 1.2.6.1 gnu/usr.bin/gdb6/arch/alpha/init.c 1.2.6.1 gnu/usr.bin/gdb6/arch/alpha/nm.h 1.2.6.1 gnu/usr.bin/gdb6/arch/arm/defs.mk 1.2.6.2 gnu/usr.bin/gdb6/arch/arm/init.c 1.1.6.1 gnu/usr.bin/gdb6/arch/armeb/config.h 1.1.6.2 gnu/usr.bin/gdb6/arch/armeb/defs.mk 1.1.6.3 gnu/usr.bin/gdb6/arch/armeb/init.c 1.1.6.2 gnu/usr.bin/gdb6/arch/armeb/tm.h 1.1.6.2 gnu/usr.bin/gdb6/arch/armeb/version.c 1.1.6.2 gnu/usr.bin/gdb6/arch/i386/defs.mk 1.4.4.1 gnu/usr.bin/gdb6/arch/i386/init.c 1.3.6.1 gnu/usr.bin/gdb6/arch/m68000/config.h 1.1.6.2 gnu/usr.bin/gdb6/arch/m68000/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/arch/m68000/init.c 1.1.6.2 gnu/usr.bin/gdb6/arch/m68000/tm.h 1.1.6.2 gnu/usr.bin/gdb6/arch/m68000/version.c 1.1.6.2 gnu/usr.bin/gdb6/arch/m68k/defs.mk 1.1.4.1 gnu/usr.bin/gdb6/arch/m68k/init.c 1.1.4.1 gnu/usr.bin/gdb6/arch/mipseb/config.h 1.3.4.1 gnu/usr.bin/gdb6/arch/mipseb/defs.mk 1.2.6.2 gnu/usr.bin/gdb6/arch/mipseb/init.c 1.2.6.2 gnu/usr.bin/gdb6/arch/mipsel/config.h 1.2.6.3 gnu/usr.bin/gdb6/arch/mipsel/defs.mk 1.2.6.3 gnu/usr.bin/gdb6/arch/mipsel/init.c 1.2.6.3 gnu/usr.bin/gdb6/arch/mipsel/tm.h 1.2.6.2 gnu/usr.bin/gdb6/arch/mipsel/version.c 1.2.6.2 gnu/usr.bin/gdb6/arch/powerpc/defs.mk 1.3.6.1 gnu/usr.bin/gdb6/arch/powerpc/init.c 1.3.6.1 gnu/usr.bin/gdb6/arch/sh3eb/config.h 1.2.2.2 gnu/usr.bin/gdb6/arch/sh3eb/defs.mk 1.2.8.3 gnu/usr.bin/gdb6/arch/sh3eb/init.c 1.1.8.3 gnu/usr.bin/gdb6/arch/sh3eb/nm.h 1.1.8.2 gnu/usr.bin/gdb6/arch/sh3eb/tm.h 1.1.8.2 gnu/usr.bin/gdb6/arch/sh3eb/version.c 1.1.8.2 gnu/usr.bin/gdb6/arch/sh3el/config.h 1.2.2.2 gnu/usr.bin/gdb6/arch/sh3el/defs.mk 1.2.8.3 gnu/usr.bin/gdb6/arch/sh3el/init.c 1.1.8.3 gnu/usr.bin/gdb6/arch/sh3el/nm.h 1.1.8.2 gnu/usr.bin/gdb6/arch/sh3el/tm.h 1.1.8.2 gnu/usr.bin/gdb6/arch/sh3el/version.c 1.1.8.2 gnu/usr.bin/gdb6/arch/sparc/defs.mk 1.2.6.1 gnu/usr.bin/gdb6/arch/sparc/init.c 1.1.6.1 gnu/usr.bin/gdb6/arch/sparc64/defs.mk 1.2.6.1 gnu/usr.bin/gdb6/arch/sparc64/init.c 1.1.6.1 gnu/usr.bin/gdb6/arch/vax/config.h 1.1.6.2 gnu/usr.bin/gdb6/arch/vax/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/arch/vax/init.c 1.1.6.2 gnu/usr.bin/gdb6/arch/vax/tm.h 1.1.6.2 gnu/usr.bin/gdb6/arch/vax/version.c 1.1.6.2 gnu/usr.bin/gdb6/arch/x86_64/defs.mk 1.2.6.1 gnu/usr.bin/gdb6/arch/x86_64/init.c 1.1.6.1 gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/armeb/config.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/m68000/config.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h 1.1.8.3 gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h 1.1.8.2 gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h 1.1.8.2 gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk 1.1.8.3 gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h 1.1.8.3 gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h 1.1.8.2 gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h 1.1.8.2 gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk 1.1.8.3 gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/vax/config.h 1.1.6.2 gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/gdb/Makefile 1.5.2.1.2.2 gnu/usr.bin/gdb6/gdbtui/Makefile 1.2.6.1 gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h 1.1.6.2 gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h 1.1.6.2 gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h 1.1.6.2 gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h 1.1.8.2 gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk 1.1.8.2 gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h 1.1.8.2 gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk 1.1.8.2 gnu/usr.bin/gdb6/libiberty/arch/vax/config.h 1.1.6.2 gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h 1.1.6.2 gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h 1.1.6.2 gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h 1.1.6.2 gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h 1.1.8.2 gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk 1.1.8.3 gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h 1.1.8.2 gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk 1.1.8.3 gnu/usr.bin/gdb6/opcodes/arch/vax/config.h 1.1.6.2 gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/readline/arch/armeb/config.h 1.1.6.2 gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/readline/arch/m68000/config.h 1.1.6.2 gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/readline/arch/mipsel/config.h 1.1.6.2 gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h 1.1.8.2 gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk 1.1.8.2 gnu/usr.bin/gdb6/readline/arch/sh3el/config.h 1.1.8.2 gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk 1.1.8.2 gnu/usr.bin/gdb6/readline/arch/vax/config.h 1.1.6.2 gnu/usr.bin/gdb6/readline/arch/vax/defs.mk 1.1.6.2 gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h 1.1.2.1 gnu/usr.bin/gdb6/sim/arch/mipseb/config.h 1.1.2.1 gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk 1.1.2.1 gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h 1.1.2.1 gnu/usr.bin/gdb6/sim/arch/mipsel/config.h 1.1.2.1 gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk 1.1.2.1 lib/libkvm/kvm_sparc64.c 1.10.18.2 lib/libpthread/pthread.c 1.48.6.4 lib/libpthread/pthread_barrier.c 1.6.18.1 lib/libpthread/pthread_cond.c 1.18.12.2 lib/libpthread/pthread_debug.h 1.8.18.1 lib/libpthread/pthread_int.h 1.34.4.5 lib/libpthread/pthread_lock.c 1.14.6.1 lib/libpthread/pthread_mutex.c 1.22.4.2 lib/libpthread/pthread_run.c 1.18.12.4 lib/libpthread/pthread_rwlock.c 1.13.6.2 lib/libpthread/pthread_sa.c 1.37.6.5 lib/libpthread/pthread_sig.c 1.47.4.8 lib/libpthread/pthread_sleep.c 1.7.6.2 lib/libpthread/sem.c 1.9.6.2 lib/libpthread/arch/sh3/pthread_md.h 1.3.6.1 regress/lib/libpthread/resolv/Makefile 1.1.12.1 regress/lib/libpthread/sigrunning/Makefile 1.1.2.1 regress/lib/libpthread/sigrunning/sigrunning.c 1.1.2.1 share/mk/bsd.own.mk 1.489.4.3 sys/arch/amd64/amd64/locore.S 1.18.14.1 sys/arch/amd64/amd64/machdep.c 1.44.2.3.2.1 sys/arch/amd64/conf/kern.ldscript 1.1.70.1 sys/arch/cats/conf/Makefile.cats.inc 1.17.30.1 sys/arch/shark/conf/Makefile.shark.inc 1.6.30.1 sys/arch/sparc64/conf/kern.ldscript 1.7.26.2 sys/arch/sparc64/conf/kern32.ldscript 1.6.26.2 sys/arch/sparc64/include/kcore.h 1.4.92.2 sys/arch/sparc64/sparc64/locore.s 1.232.4.4 sys/arch/sparc64/sparc64/machdep.c 1.193.4.3 sys/arch/sparc64/sparc64/pmap.c 1.184.2.1.2.4 sys/conf/newvers.sh 1.42.26.2 sys/kern/kern_sa.c 1.87.4.11 sys/kern/kern_synch.c 1.173.4.2 sys/sys/savar.h 1.20.10.2 tools/gdb/Makefile 1.9.4.1 tools/gdb/mknative-gdb 1.1.6.1 pullup the wrstuden-fixsa CVS branch to netbsd-4: toolchain/35540 - GDB 6 support for pthreads. port-sparc64/37534 - ktrace firefox gives kernel trap 30: data access expection GDB changes: - delete gdb53 - enable gdb6 on all architectures - add support for amd64 crash dumps - add support for sparc64 crash dumps - add support for /proc pid to executable filename for all archs - enable thread support for all architectures - add a note section to kernels to all platforms - support detection/unwinding of signals for most architectures. - Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3. - Apply fix from binutils-current so that sparc gdb can be cross built on a 64bit host. SA/pthread changes: Pre-allocate memory needed for event delivery. Eliminates dropped interrupts under load. Deliver intra-process signals to running threads Eliminate some deadlock scenarios Fix intra-process signal delivery when delivering to a thread waiting for signals. Makes afs work again!
Sync w/ -current. 34 merge conflicts to follow.
sync with head
PR lib/38741 priority inversion in libpthread breaks apps that use SCHED_FIFO threads - Change condvar sync so that we never take the condvar's spinlock without first holding the caller-provided mutex. Previously, the spinlock was only taken without the mutex in an error path, but it was enough to trigger the problem described in the PR. - Even with this change, applications calling pthread_cond_signal/broadcast without holding the interlocking mutex are still subject to the problem described in the PR. POSIX discourages this saying that it leads to undefined scheduling behaviour, which seems good enough for the time being. - Elsewhere, use a hash of mutexes instead of per-object spinlocks to synchronize entry/exit from sleep queues. - Simplify how sleep queues are maintained.
file pthread_barrier.c was added on branch christos-time_t on 2008-05-25 17:05:29 +0000
PR lib/38741 priority inversion in libpthread breaks apps that use SCHED_FIFO threads - Change condvar sync so that we never take the condvar's spinlock without first holding the caller-provided mutex. Previously, the spinlock was only taken without the mutex in an error path, but it was enough to trigger the problem described in the PR. - Even with this change, applications calling pthread_cond_signal/broadcast without holding the interlocking mutex are still subject to the problem described in the PR. POSIX discourages this saying that it leads to undefined scheduling behaviour, which seems good enough for the time being. - Elsewhere, use a hash of mutexes instead of per-object spinlocks to synchronize entry/exit from sleep queues. - Simplify how sleep queues are maintained.
sync with head.
Remove clause 3 and 4 from TNF licenses
sync with HEAD
Remove the debuglog stuff. ktrace is more useful now.
For PR bin/37347: - Override __libc_thr_init() instead of using our own constructor. - Add pthread__getenv() and use instead of getenv(). This is used before we are up and running and unfortunatley getenv() takes locks. Other changes: - Cache the spinlock vectors in pthread__st. Internal spinlock operations now take 1 function call instead of 3 (i386). - Use pthread__self() internally, not pthread_self(). - Use __attribute__ ((visibility("hidden"))) in some places. - Kill PTHREAD_MAIN_DEBUG.
Check in first step towards having pthread_kill() kill a thread running on another CPU. This change adds initial support for deferred signal handling. Just before we go to sleep and while we hold &self->pt_statelock, check to see if we have any deferred signals (blocked signals) pending. These are signals that are not masked in our mask and which have been sent to us. We were running when they came in. Further, since they are being handled this way, there's a signal handler defined for them. So unlock, run the signal handler(s), then carry on. For condition variables, we consider this a spurious wakeup, so we just return 0, having not unlocked the mutex. We run the handler with the mutex held. This shouldn't matter, as you aren't supposed to play with mutexes in signal handlers. :-) For nanosleep(), we just process signals, then go to sleep. For all other cases, we are in a loop with some external predicate. So we process the signal then roll around the loop to see if it still applies. In sched_yield(), spin until all deferred signals are gone. Since we hold self->pt_statelock and that lock has to be held before sending a deferred signal, no new deferred signals will come in until we're asleep. While here, be more careful about locking while changing pt_state to PT_STATE_RUNNING. Grab pt_statelock while doing it, and also set next->pt_vpid to self->pt_vpid holding the same lock. Will make the test to determine how to deliver a signal work right (since a thread's vpid will soon matter in the general case). No longer set next->pt_vpid in pthread__next().
Sync with HEAD.
Trim fat off libpthread internal spinlock operations. Makes a mesurable improvement across the board.
Sync with HEAD.
Some significant performance improvements, and a fix for a race with pthread detach/join. - Make mutex acquire spin for a short time, as done with spinlocks. - Make the number of spins controllable with the env var PTHREAD_NSPINS. - Reduce the amount of time that libpthread internal spinlocks are held. - Rely more on the barrier effects of park/unpark to avoid taking spinlocks. - Simplify the locking around pthreads and the global queues. - Align per-thread sync data on a 128 byte boundary. - Offset thread stacks by a small amount to try and reduce cache thrash.
file pthread_barrier.c was added on branch matt-mips64 on 2007-08-04 13:37:50 +0000
Some significant performance improvements, and a fix for a race with pthread detach/join. - Make mutex acquire spin for a short time, as done with spinlocks. - Make the number of spins controllable with the env var PTHREAD_NSPINS. - Reduce the amount of time that libpthread internal spinlocks are held. - Rely more on the barrier effects of park/unpark to avoid taking spinlocks. - Simplify the locking around pthreads and the global queues. - Align per-thread sync data on a 128 byte boundary. - Offset thread stacks by a small amount to try and reduce cache thrash.
- Test+branch is usually cheaper than making an indirect function call, so avoid making them. - When parking an LWP on a condition variable, point the hint argument at the mutex's waiters queue. Chances are we will be awoken from that later.
Update to match changed pthread__park() interface.
Remove the PTHREAD_SA option. If M:N threads is reimplemented it's better off done with a seperate library.
Remove more duplicate #includes, and a few spurious whitespaces at EOL From Slava Semushin <slava.semushin@gmail.com>
Fix bugs with and improve upon previous.
Conditionalised support for 1:1 threads. Needs associated kernel changes and more work to be useful.
add __RCSID()
Remove unnecessary inclusion of <assert.h>.
Use pthread__sched_sleepers() instead of iterating over sleep queues ourself.
Make pthread_barrier_wait() handle spurious wakeups from pthread__block() by adding a generation number to the barrier structure and incrementing it when the barrier fires. XXX this is an ABI change for anything using barriers, but the library is new enough and nothing in the tree uses barriers so I'm going to let it slide. Using the private data pointer for a field that will always be present would be excessive.
Merge the nathanw_sa branch.
Implement the pthread_barrier API.
file pthread_barrier.c was initially added on branch nathanw_sa.