diff options
| author | Jason Evans <jasone@FreeBSD.org> | 2000-06-14 17:17:41 +0000 |
|---|---|---|
| committer | Jason Evans <jasone@FreeBSD.org> | 2000-06-14 17:17:41 +0000 |
| commit | 314be1347ba3b74b5e67aad5053dba8919768624 (patch) | |
| tree | 5b1354c7e5ebafa899c00de702a53fbc1481f1fc /lib/libpthread/thread/thr_mutex.c | |
| parent | 979ab7516260eb8e17b93759826df578635fdbe9 (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_mutex.c')
| -rw-r--r-- | lib/libpthread/thread/thr_mutex.c | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/lib/libpthread/thread/thr_mutex.c b/lib/libpthread/thread/thr_mutex.c index c97c86b0bb45..12fdc8e697b8 100644 --- a/lib/libpthread/thread/thr_mutex.c +++ b/lib/libpthread/thread/thr_mutex.c @@ -612,7 +612,6 @@ pthread_mutex_lock(pthread_mutex_t * mutex) */ if (_thread_run->interrupted != 0) { mutex_queue_remove(*mutex, _thread_run); - ret = EINTR; } /* Unlock the mutex structure: */ @@ -777,11 +776,20 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference) if (((*mutex)->m_owner = mutex_queue_deq(*mutex)) != NULL) { /* - * Allow the new owner of the mutex to - * run: + * Unless the new owner of the mutex is + * currently suspended, allow the owner + * to run. If the thread is suspended, + * make a note that the thread isn't in + * a wait queue any more. */ - PTHREAD_NEW_STATE((*mutex)->m_owner, - PS_RUNNING); + if (((*mutex)->m_owner->state != + PS_SUSPENDED)) { + PTHREAD_NEW_STATE((*mutex)->m_owner, + PS_RUNNING); + } else { + (*mutex)->m_owner->suspended = + SUSP_NOWAIT; + } /* * Add the mutex to the threads list of @@ -899,11 +907,20 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference) (*mutex)->m_prio; /* - * Allow the new owner of the mutex to - * run: + * Unless the new owner of the mutex is + * currently suspended, allow the owner + * to run. If the thread is suspended, + * make a note that the thread isn't in + * a wait queue any more. */ - PTHREAD_NEW_STATE((*mutex)->m_owner, - PS_RUNNING); + if (((*mutex)->m_owner->state != + PS_SUSPENDED)) { + PTHREAD_NEW_STATE((*mutex)->m_owner, + PS_RUNNING); + } else { + (*mutex)->m_owner->suspended = + SUSP_NOWAIT; + } } } break; @@ -1019,11 +1036,20 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference) (*mutex)->m_prio; /* - * Allow the new owner of the mutex to - * run: + * Unless the new owner of the mutex is + * currently suspended, allow the owner + * to run. If the thread is suspended, + * make a note that the thread isn't in + * a wait queue any more. */ - PTHREAD_NEW_STATE((*mutex)->m_owner, - PS_RUNNING); + if (((*mutex)->m_owner->state != + PS_SUSPENDED)) { + PTHREAD_NEW_STATE((*mutex)->m_owner, + PS_RUNNING); + } else { + (*mutex)->m_owner->suspended = + SUSP_NOWAIT; + } } } break; |
