Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [netbsd-3] src/lib/libpthread



Module Name:    src
Committed By:   jmc
Date:           Tue Nov  1 20:01:44 UTC 2005

Modified Files:
        src/lib/libpthread [netbsd-3]: sem.c

Log Message:
Pullup revs 1.8-1.9 (requested by chs in ticket #926)
 In pthread_mutex_lock_slow(), pthread_rwlock_timedrdlock() and sem_wait(),
 call pthread__start() if it hasn't already been called. this avoids
 an internal assertion from the library if these routines are used
 before any threads are created and they need to sleep.
 PR#20256, PR#24241, PR#25722, PR#26096

 Fix the interaction between sigtimedwait() and pthread_kill(),
 both waking up a sleeping thread and avoiding going to sleep if
 a signal is already pending. PR#30348

 In pthread_kill() and pthread_suspend_np(), return without doing anything
 f the target thread is a zombie.
 In all the functions that didn't do so already, verify a pthread_t before
 dereferencing it (under #ifdef ERRORCHECK, since these checks are not
 mandated by the standard).

 Starting the pthread library (ie. calling pthread__start()) before
 any threads are created turned out to be not such a good idea.
 there are stronger requirements on what has to work in a forked child
 while a process is still single-threaded. so take all that stuff
 back out and fix the problems with single-threaded programs that
 are linked with libpthread differently, by checking if the library
 has been started and doing completely different stuff if it hasn't been:
 - for pthread_rwlock_timedrdlock(), just fail with EDEADLK immediately.
 - for sem_wait(), the only thing that can unlock the semaphore is a
 signal handler, so use sigsuspend() to wait for a signal.
 - for pthread_mutex_lock_slow(), just go into an infinite loop
 waiting for signals.

 If mlock() fails in pthread_create(), return EAGAIN instead of
 failing an assertion.


To generate a diff of this commit:
cvs rdiff -r1.7 -r1.7.6.1 src/lib/libpthread/sem.c

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