Hello,
I'm trying to use t_delete routine in psos skin (xenomai-2.4.7) from a
user space application .
I'm encountring two different behaviors:
-1- Calling t_delete(0) from a psos task seems to work perfectly (e.g.
task self deletes).
-2- Calling t_delete(task_id) with another task id (e.g. current task
tries to delete another task) doesn't result in task deletion but
returns 0 (success).
I've been through both psos skin (ksrc/psos+/task.c) and nucleus
(ksrc/nucleus/pod.c) source code.
xnpod_delete_thread() behaves differently depending on previously
described t_delete calls:
-1- First case (t_delete(0)):
Execution skip condition in ksrc/nucleus/pod.c at line 1173:
if (xnthread_user_task(thread) != NULL &&
!xnthread_test_state(thread, XNDORMANT) &&
!xnpod_current_p(thread)) {
if (!xnpod_userspace_p())
xnshadow_send_sig(thread, SIGKILL, 1);
/*
* Otherwise, assume the interface library has issued
* pthread_cancel on the target thread, which should
* cause the current service to be called for
* self-deletion of that thread.
*/
goto unlock_and_exit;
}
#endif /* CONFIG_XENO_OPT_PERVASIVE */
and continues to run after it. This results in a successful deletion.
-2- Second case:
Execution enters one of the first conditions (if
(xnthread_user_task(thread))...) but skip the second one :
xnshadow_send_sig(thread, SIGKILL, 1) is not executed;
goto unlock_and_exit; instruction is then executed.
->Our thread is never deleted.
-3-
Modifing actual source code by commenting goto intruction or moving it
into second condition (if (!xnpod_userspace_p()) mentioned above)
results in a working t_delete (task_id).
- I'm not sure of the possible side effects of such a modification?
- Is it correct to do so?
As mentioned in the source code comment, it is assumed "the interface
library has issued pthread_cancel" ...
I assume it might be missing somewhere?
Please can you help on this topic?
Thanks in advance.
Please find a patch regarding this modification.
diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 9348ce1..ee362df 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -1177,14 +1177,16 @@ void xnpod_delete_thread(xnthread_t *thread)
!xnthread_test_state(thread, XNDORMANT) &&
!xnpod_current_p(thread)) {
if (!xnpod_userspace_p())
+ {
xnshadow_send_sig(thread, SIGKILL, 1);
+ goto unlock_and_exit;
+ }
/*
* Otherwise, assume the interface library has issued
* pthread_cancel on the target thread, which should
* cause the current service to be called for
* self-deletion of that thread.
*/
- goto unlock_and_exit;
}
#endif /* CONFIG_XENO_OPT_PERVASIVE */
Fabrice.
--------------------------------
CénoSYS <http://www.cenosys.com>
10, Rue Xavier Bichat
F-72000 Le MANS
--------------------------------
diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 9348ce1..ee362df 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -1177,14 +1177,16 @@ void xnpod_delete_thread(xnthread_t *thread)
!xnthread_test_state(thread, XNDORMANT) &&
!xnpod_current_p(thread)) {
if (!xnpod_userspace_p())
+ {
xnshadow_send_sig(thread, SIGKILL, 1);
+ goto unlock_and_exit;
+ }
/*
* Otherwise, assume the interface library has issued
* pthread_cancel on the target thread, which should
* cause the current service to be called for
* self-deletion of that thread.
*/
- goto unlock_and_exit;
}
#endif /* CONFIG_XENO_OPT_PERVASIVE */
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help