Commit 2e6fb812 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/thread: skip boundary check for infinite round-robin time slice

Disabling round-robin is obtained by passing XN_INFINITE for quantum
to xnthread_set_slice(), which is zero: we don't want to check such
value against the clock gravity.

As a matter of fact, this bug may have prevented the RR mode to be
switched off for years, causing the routine to always fail early with
-EINVAL.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent e9708b41
......@@ -1471,16 +1471,14 @@ int xnthread_set_slice(struct xnthread *thread, xnticks_t quantum)
struct xnsched *sched;
spl_t s;
if (quantum <= xnclock_get_gravity(&nkclock, user))
return -EINVAL;
xnlock_get_irqsave(&nklock, s);
sched = thread->sched;
thread->rrperiod = quantum;
if (quantum != XN_INFINITE) {
if (thread->base_class->sched_tick == NULL) {
if (quantum <= xnclock_get_gravity(&nkclock, user) ||
thread->base_class->sched_tick == NULL) {
xnlock_put_irqrestore(&nklock, s);
return -EINVAL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment