summaryrefslogtreecommitdiffstats
path: root/lib/libkse/thread/thr_mutex.c
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2002-05-24 04:32:28 +0000
committerdeischen <deischen@FreeBSD.org>2002-05-24 04:32:28 +0000
commit9ba1f9fa381dcbfb861533fdda13f9f27da78f14 (patch)
tree15691e04d3960954bb9843fcfd9d5beaf2553f80 /lib/libkse/thread/thr_mutex.c
parentabd4f3d6cc97e6f9042d207b7f1442f11860e88d (diff)
downloadFreeBSD-src-9ba1f9fa381dcbfb861533fdda13f9f27da78f14.zip
FreeBSD-src-9ba1f9fa381dcbfb861533fdda13f9f27da78f14.tar.gz
Revamp suspend and resume. While I'm here add pthread_suspend_all_np()
and pthread_resume_all_np(). These suspend and resume all threads except the current thread, respectively. The existing functions pthread_single_np() and pthread_multi_np(), which formerly had no effect, now exhibit the same behaviour and pthread_suspend_all_np() and pthread_resume_all_np(). These functions have been added mostly for the native java port. Don't allow the uthread kernel pipe to use the same descriptors as stdio. Mostily submitted by Oswald Buddenhagen <ossi@kde.org>. Correct some minor style nits.
Diffstat (limited to 'lib/libkse/thread/thr_mutex.c')
-rw-r--r--lib/libkse/thread/thr_mutex.c50
1 files changed, 9 insertions, 41 deletions
diff --git a/lib/libkse/thread/thr_mutex.c b/lib/libkse/thread/thr_mutex.c
index 0f67b4b..86e0b8b 100644
--- a/lib/libkse/thread/thr_mutex.c
+++ b/lib/libkse/thread/thr_mutex.c
@@ -887,21 +887,9 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
*/
if (((*mutex)->m_owner =
mutex_queue_deq(*mutex)) != NULL) {
- /*
- * 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.
- */
- if (((*mutex)->m_owner->state !=
- PS_SUSPENDED)) {
- PTHREAD_NEW_STATE((*mutex)->m_owner,
- PS_RUNNING);
- } else {
- (*mutex)->m_owner->suspended =
- SUSP_NOWAIT;
- }
+ /* Make the new owner runnable: */
+ PTHREAD_NEW_STATE((*mutex)->m_owner,
+ PS_RUNNING);
/*
* Add the mutex to the threads list of
@@ -1019,20 +1007,10 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
(*mutex)->m_prio;
/*
- * 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.
+ * Make the new owner runnable:
*/
- if (((*mutex)->m_owner->state !=
- PS_SUSPENDED)) {
- PTHREAD_NEW_STATE((*mutex)->m_owner,
- PS_RUNNING);
- } else {
- (*mutex)->m_owner->suspended =
- SUSP_NOWAIT;
- }
+ PTHREAD_NEW_STATE((*mutex)->m_owner,
+ PS_RUNNING);
}
}
break;
@@ -1148,20 +1126,10 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
(*mutex)->m_prio;
/*
- * 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.
+ * Make the new owner runnable:
*/
- if (((*mutex)->m_owner->state !=
- PS_SUSPENDED)) {
- PTHREAD_NEW_STATE((*mutex)->m_owner,
- PS_RUNNING);
- } else {
- (*mutex)->m_owner->suspended =
- SUSP_NOWAIT;
- }
+ PTHREAD_NEW_STATE((*mutex)->m_owner,
+ PS_RUNNING);
}
}
break;
OpenPOWER on IntegriCloud