summaryrefslogtreecommitdiffstats
path: root/lib/libkse/thread/thr_setschedparam.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libkse/thread/thr_setschedparam.c')
-rw-r--r--lib/libkse/thread/thr_setschedparam.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libkse/thread/thr_setschedparam.c b/lib/libkse/thread/thr_setschedparam.c
index 1be9f91..18cddfc 100644
--- a/lib/libkse/thread/thr_setschedparam.c
+++ b/lib/libkse/thread/thr_setschedparam.c
@@ -64,6 +64,13 @@ _pthread_setschedparam(pthread_t pthread, int policy,
* its priority:
*/
THR_SCHED_LOCK(curthread, pthread);
+ if ((pthread->state == PS_DEAD) ||
+ (pthread->state == PS_DEADLOCK) ||
+ ((pthread->flags & THR_FLAGS_EXITING) != 0)) {
+ THR_SCHED_UNLOCK(curthread, pthread);
+ _thr_ref_delete(curthread, pthread);
+ return (ESRCH);
+ }
in_syncq = pthread->flags & THR_FLAGS_IN_SYNCQ;
/* Set the scheduling policy: */
OpenPOWER on IntegriCloud