Module: xenomai-3 Branch: stable-3.0.x Commit: 368f1ef5d1bb67d90159ea912e58d6a3dacc89a8 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=368f1ef5d1bb67d90159ea912e58d6a3dacc89a8
Author: Jan Kiszka <jan.kis...@siemens.com> Date: Wed Jul 26 17:59:27 2017 +0200 cobalt: Do not destroy info flags on remote thread suspension Scenario: A high prio thread is running and a low-prio is waiting for a timeout. Now the timeout occurs, and the low-prio thread is woken up but can't run yet. If the high-prio thread suspends the low-prio one, XNTIMEO will be lost due to that. Similar scenarios a possible with other info flags and remote suspension reasons. Address them by clearing info flags only if the current thread is suspending itself. Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- kernel/cobalt/thread.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index 1fdea99..067026e 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -900,8 +900,13 @@ void xnthread_suspend(struct xnthread *thread, int mask, (oldstate & XNTRAPLB) != 0) goto lock_break; } - xnthread_clear_info(thread, - XNRMID|XNTIMEO|XNBREAK|XNWAKEN|XNROBBED|XNKICKED); + /* + * Do not destroy the info left behind by yet unprocessed + * wakeups when suspending a remote thread. + */ + if (thread == sched->curr) + xnthread_clear_info(thread, XNRMID|XNTIMEO|XNBREAK| + XNWAKEN|XNROBBED|XNKICKED); } /* _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git