summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_setschedparam.c
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>1999-06-20 08:28:48 +0000
committerJohn Birrell <jb@FreeBSD.org>1999-06-20 08:28:48 +0000
commit02292f131acd0fc6c16b950f1e6b05e75de2cdcb (patch)
tree0ff88e4b640389e399994c81f9addd13093029cb /lib/libpthread/thread/thr_setschedparam.c
parentc2077034654a87e5a0517430c4d0c7d10721e484 (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_setschedparam.c')
-rw-r--r--lib/libpthread/thread/thr_setschedparam.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libpthread/thread/thr_setschedparam.c b/lib/libpthread/thread/thr_setschedparam.c
index 93635da449cd..1ba0e207275e 100644
--- a/lib/libpthread/thread/thr_setschedparam.c
+++ b/lib/libpthread/thread/thr_setschedparam.c
@@ -29,6 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
+ * $Id$
*/
#include <errno.h>
#include <sys/param.h>
@@ -50,10 +51,10 @@ pthread_setschedparam(pthread_t pthread, int policy, struct sched_param *param)
/* Find the thread in the list of active threads: */
else if ((ret = _find_thread(pthread)) == 0) {
/*
- * Guard against being preempted by a scheduling
- * signal:
+ * Defer signals to protect the scheduling queues from
+ * access by the signal handler:
*/
- _thread_kern_sched_defer();
+ _thread_kern_sig_defer();
if (param->sched_priority != pthread->base_priority) {
/*
@@ -61,8 +62,7 @@ pthread_setschedparam(pthread_t pthread, int policy, struct sched_param *param)
* queue before any adjustments are made to its
* active priority:
*/
- if ((pthread != _thread_run) &&
- (pthread->state == PS_RUNNING)) {
+ if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0) {
in_readyq = 1;
old_prio = pthread->active_priority;
PTHREAD_PRIOQ_REMOVE(pthread);
@@ -103,10 +103,10 @@ pthread_setschedparam(pthread_t pthread, int policy, struct sched_param *param)
pthread->attr.sched_policy = policy;
/*
- * Renable preemption and yield if a scheduling signal
- * arrived while in the critical region:
+ * Undefer and handle pending signals, yielding if
+ * necessary:
*/
- _thread_kern_sched_undefer();
+ _thread_kern_sig_undefer();
}
return(ret);
}