list. setpriority() is trivial and probably faster than releasing and
relocking SCHED_LOCK().
OK jca@
-/* $OpenBSD: kern_resource.c,v 1.82 2024/05/20 10:32:20 claudio Exp $ */
+/* $OpenBSD: kern_resource.c,v 1.83 2024/05/22 09:20:22 claudio Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*-
return (EACCES);
chgpr->ps_nice = n;
mtx_enter(&chgpr->ps_mtx);
+ SCHED_LOCK(s);
TAILQ_FOREACH(p, &chgpr->ps_threads, p_thr_link) {
- SCHED_LOCK(s);
setpriority(p, p->p_estcpu, n);
- SCHED_UNLOCK(s);
}
+ SCHED_UNLOCK(s);
mtx_leave(&chgpr->ps_mtx);
return (0);
}