[Xenomai-git] Philippe Gerum : cobalt/thread: send SIGTERM to weak user threads upon cancellation request
Module: xenomai-3 Branch: master Commit: 7237c9fc17bb33ae3b3105a38e86e3a50f22e84c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7237c9fc17bb33ae3b3105a38e86e3a50f22e84c Author: Philippe Gerum Date: Sat Feb 14 17:23:54 2015 +0100 cobalt/thread: send SIGTERM to weak user threads upon cancellation request A userland thread undergoing the weak scheduling policy is unlikely to issue Cobalt syscalls frequently, which may defer cancellation significantly: send it a regular termination signal too. --- kernel/cobalt/thread.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index a635611..7885beb 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -1480,8 +1480,7 @@ void xnthread_cancel(struct xnthread *thread) if (xnthread_test_state(thread, XNDORMANT)) { xnthread_set_info(thread, XNKICKED); xnthread_resume(thread, XNDORMANT); - xnsched_run(); - goto unlock_and_exit; + goto out; } check_self_cancel: @@ -1496,10 +1495,19 @@ check_self_cancel: } __xnthread_demote(thread); - xnsched_run(); -unlock_and_exit: + /* +* A userland thread undergoing the weak scheduling policy is +* unlikely to issue Cobalt syscalls frequently, which may +* defer cancellation significantly: send it a regular +* termination signal too. +*/ + if (xnthread_test_state(thread, XNWEAK|XNUSER) == (XNWEAK|XNUSER)) + xnthread_signal(thread, SIGTERM, 0); +out: xnlock_put_irqrestore(&nklock, s); + + xnsched_run(); } EXPORT_SYMBOL_GPL(xnthread_cancel); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/thread: send SIGTERM to weak user threads upon cancellation request
Module: xenomai-3 Branch: next Commit: 7237c9fc17bb33ae3b3105a38e86e3a50f22e84c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7237c9fc17bb33ae3b3105a38e86e3a50f22e84c Author: Philippe Gerum Date: Sat Feb 14 17:23:54 2015 +0100 cobalt/thread: send SIGTERM to weak user threads upon cancellation request A userland thread undergoing the weak scheduling policy is unlikely to issue Cobalt syscalls frequently, which may defer cancellation significantly: send it a regular termination signal too. --- kernel/cobalt/thread.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index a635611..7885beb 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -1480,8 +1480,7 @@ void xnthread_cancel(struct xnthread *thread) if (xnthread_test_state(thread, XNDORMANT)) { xnthread_set_info(thread, XNKICKED); xnthread_resume(thread, XNDORMANT); - xnsched_run(); - goto unlock_and_exit; + goto out; } check_self_cancel: @@ -1496,10 +1495,19 @@ check_self_cancel: } __xnthread_demote(thread); - xnsched_run(); -unlock_and_exit: + /* +* A userland thread undergoing the weak scheduling policy is +* unlikely to issue Cobalt syscalls frequently, which may +* defer cancellation significantly: send it a regular +* termination signal too. +*/ + if (xnthread_test_state(thread, XNWEAK|XNUSER) == (XNWEAK|XNUSER)) + xnthread_signal(thread, SIGTERM, 0); +out: xnlock_put_irqrestore(&nklock, s); + + xnsched_run(); } EXPORT_SYMBOL_GPL(xnthread_cancel); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git