summaryrefslogtreecommitdiffstats
path: root/lib/libc_r/uthread/uthread_mutex.c
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2000-03-15 13:59:27 +0000
committerdeischen <deischen@FreeBSD.org>2000-03-15 13:59:27 +0000
commit228266df1122dd0b3102d45629ae1e0d7ae42f31 (patch)
treedbe86a4d7c4333049e4c8db5b8b117b8ae2e6c7c /lib/libc_r/uthread/uthread_mutex.c
parent87a0ee8fd64ec5f1e02e3bef4a0de750d7bede50 (diff)
downloadFreeBSD-src-228266df1122dd0b3102d45629ae1e0d7ae42f31.zip
FreeBSD-src-228266df1122dd0b3102d45629ae1e0d7ae42f31.tar.gz
Fix pthread_suspend_np/pthread_resume_np. For the record, suspending a
thread waiting on an event (I/O, condvar, etc) will, when resumed using pthread_resume_np, return with EINTR. For example, suspending and resuming a thread blocked on read() will not requeue the thread for the read, but will return -1 with errno = EINTR. If the suspended thread is in a critical region, the thread is suspended as soon as it leaves the critical region. Fix a bogon in pthread_kill() where a signal was being delivered twice to threads waiting in sigwait(). Reported by (suspend/resume bug): jdp Reviewed by: jasone
Diffstat (limited to 'lib/libc_r/uthread/uthread_mutex.c')
-rw-r--r--lib/libc_r/uthread/uthread_mutex.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_mutex.c b/lib/libc_r/uthread/uthread_mutex.c
index 6d75ea5..c97c86b 100644
--- a/lib/libc_r/uthread/uthread_mutex.c
+++ b/lib/libc_r/uthread/uthread_mutex.c
@@ -610,8 +610,10 @@ pthread_mutex_lock(pthread_mutex_t * mutex)
* Check to see if this thread was interrupted and
* is still in the mutex queue of waiting threads:
*/
- if (_thread_run->interrupted != 0)
+ if (_thread_run->interrupted != 0) {
mutex_queue_remove(*mutex, _thread_run);
+ ret = EINTR;
+ }
/* Unlock the mutex structure: */
_SPINUNLOCK(&(*mutex)->lock);
OpenPOWER on IntegriCloud