Philippe Gerum wrote:
Jan Kiszka wrote:
Hi Philippe,
please have a look at skins/rtai/syscall.c:
static xnsysent_t __systab[] = {
...
[__rtai_task_delete ] = { &__rt_task_delete, __xn_exec_primary },
^^^^^^^^^^^^^^^^^
Is this restriction to shadow threads unavoidable? I was trying to
kill a task from main(), while main() was not converted into a fusion
thread.
I think the reason is that, to commit suicide, a fusion thread has to
be switched back to primary mode. But then, how to explicitly kill a
task from Linux context? The succeeding pthread_cancel in lib/task.c
does not have any effect, only the process termination finally cleans
up. That was too late in my case - the task went wild before due to
other resource cleanups. One may avoid such scenarios, but it makes
the usage of rt_task_delete unintuitive.
What about this: use __xn_exec_any, but switch back in
__rt_task_delete if self-deletion is detected (task == self).
As you noticed, the primary mode is only requested for threads
committing suicide, but not for others. I think that using the
__xn_exec_conforming mode for this syscall would do it.
Aah, yet another syscall flag! Sorry, to forget about this one. ;)
Indeed, this works very well. Please apply to cvs.
Thanks,
Jan