From 9ba1f9fa381dcbfb861533fdda13f9f27da78f14 Mon Sep 17 00:00:00 2001 From: deischen Date: Fri, 24 May 2002 04:32:28 +0000 Subject: 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 . Correct some minor style nits. --- lib/libkse/thread/thr_cond.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'lib/libkse/thread/thr_cond.c') diff --git a/lib/libkse/thread/thr_cond.c b/lib/libkse/thread/thr_cond.c index 7f3fe7a..cb45725 100644 --- a/lib/libkse/thread/thr_cond.c +++ b/lib/libkse/thread/thr_cond.c @@ -524,15 +524,9 @@ _pthread_cond_signal(pthread_cond_t * cond) if ((pthread = cond_queue_deq(*cond)) != NULL) { /* - * Unless the thread is currently suspended, - * allow it to run. If the thread is suspended, - * make a note that the thread isn't in a wait - * queue any more. + * Wake up the signaled thread: */ - if (pthread->state != PS_SUSPENDED) - PTHREAD_NEW_STATE(pthread,PS_RUNNING); - else - pthread->suspended = SUSP_NOWAIT; + PTHREAD_NEW_STATE(pthread, PS_RUNNING); } /* Check for no more waiters: */ @@ -596,15 +590,9 @@ _pthread_cond_broadcast(pthread_cond_t * cond) */ while ((pthread = cond_queue_deq(*cond)) != NULL) { /* - * Unless the thread is currently suspended, - * allow it to run. If the thread is suspended, - * make a note that the thread isn't in a wait - * queue any more. + * Wake up the signaled thread: */ - if (pthread->state != PS_SUSPENDED) - PTHREAD_NEW_STATE(pthread,PS_RUNNING); - else - pthread->suspended = SUSP_NOWAIT; + PTHREAD_NEW_STATE(pthread, PS_RUNNING); } /* There are no more waiting threads: */ -- cgit v1.1