Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: src/lib/libpthread
Module Name: src
Committed By: ad
Date: Fri Sep 7 14:09:29 UTC 2007
Modified Files:
src/lib/libpthread: Makefile pthread.c pthread_cond.c pthread_int.h
pthread_lock.c pthread_mutex.c pthread_rwlock.c pthread_types.h
src/lib/libpthread/arch/i386: _context_u.S
src/lib/libpthread/arch/x86_64: _context_u.S
Added Files:
src/lib/libpthread: pthread_mutex2.c pthread_rwlock2.c
Log Message:
- Don't take the mutex's spinlock (ptr_interlock) in pthread_cond_wait().
Instead, make the deferred wakeup list a per-thread array and pass down
the lwpid_t's that way.
- In pthread_cond_wait(), take the mutex before dealing with early wakeup.
In this way there should never be contention on the CV's spinlock if
the app follows POSIX rules (there should only be contention on the
user-provided mutex).
- Add a port of the kernel's rwlocks. The rwlock's spinlock is only taken if
there is contention. This is enabled where atomic ops are available. Right
now that is only i386 and amd64 because I don't have other hardware to
test with. It's trivial to add stubs for other architectures as long as
they have compare-and-swap. When we have proper atomic ops the old rwlock
code can be removed.
- Add a new mutex implementation that's similar to the kernel's mutexes, but
uses compare-and-swap to maintain the waiters list, so no spinlocks are
involved. Same caveats apply as for the rwlocks.
To generate a diff of this commit:
cvs rdiff -r1.42 -r1.43 src/lib/libpthread/Makefile
cvs rdiff -r1.80 -r1.81 src/lib/libpthread/pthread.c
cvs rdiff -r1.34 -r1.35 src/lib/libpthread/pthread_cond.c
cvs rdiff -r1.50 -r1.51 src/lib/libpthread/pthread_int.h
cvs rdiff -r1.25 -r1.26 src/lib/libpthread/pthread_lock.c
cvs rdiff -r1.31 -r1.32 src/lib/libpthread/pthread_mutex.c
cvs rdiff -r0 -r1.1 src/lib/libpthread/pthread_mutex2.c \
src/lib/libpthread/pthread_rwlock2.c
cvs rdiff -r1.20 -r1.21 src/lib/libpthread/pthread_rwlock.c
cvs rdiff -r1.7 -r1.8 src/lib/libpthread/pthread_types.h
cvs rdiff -r1.3 -r1.4 src/lib/libpthread/arch/i386/_context_u.S
cvs rdiff -r1.5 -r1.6 src/lib/libpthread/arch/x86_64/_context_u.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index