Subject: PR/26096 CVS commit: [netbsd-3] src/lib/libpthread
To: None <,,>
From: James Chacon <>
List: netbsd-bugs
Date: 11/01/2005 20:02:16
The following reply was made to PR lib/26096; it has been noted by GNATS.

From: James Chacon <>
Subject: PR/26096 CVS commit: [netbsd-3] src/lib/libpthread
Date: Tue,  1 Nov 2005 20:01:31 +0000 (UTC)

 Module Name:	src
 Committed By:	jmc
 Date:		Tue Nov  1 20:01:31 UTC 2005
 Modified Files:
 	src/lib/libpthread [netbsd-3]: pthread_rwlock.c
 Log Message:
 Pullup revs 1.12-1.13 (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.11 -r1.11.2.1 src/lib/libpthread/pthread_rwlock.c
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.