Gilles Chanteperdrix wrote:
> Wolfgang Grandegger wrote:
>> Hello,
>>
>> I have written the attached test program to cancel Xenomai POSIX
>> threads. The "calc_task" does some busy work, which the higher priority
>> task "ctrl_task" interrupts and aborts after some time. The program does
>> not behave like I expect and it also behaves differently on my PowerPC
>> and ARM test system. The "calc_task" continues after calling
>> pthread_cancel() in "ctrl_task". On ARM, the behaviour is even more
>> wired. Is there anything wrong in my test program or anything else I
>> should care of?
> 
> First, you should know that PTHREAD_CANCEL_ASYNCHRONOUS is evil, it will
> almost inevitably leave things in an unknown state when canceling a
> thread, you would better use PTHREAD_CANCEL_DEFERRED and ensure that
> your thread has some cancellation point, if it has not, use
> pthread_testcancel.

Actually I want to do a defined exit in case on a fatal error condition.
Normally I just would printf an error message and call exit to abort the
whole application. Things are more tricky with Xenomai. For error
logging and debugging, I'm using rt_printk() (RTDK) and I want to see
all messages till the fatal error occurred, which requires stopping all
activity/tasks of the scheduler. My idea was to cancel all non-active
tasks, wait for a few hundredth milliseconds before calling finally
exit. Maybe there is a simpler method to achieve such a defined abort.

> Second, your program will only work if root thread priority coupling is
> enabled. Is it enabled in your case?

Where can I read more about this thread priority coupling? I see
different ROOT priorities when using USE_EXPLICIT_SCHED.

Wolfgang,


_______________________________________________
Xenomai-help mailing list
Xenomai-help@gna.org
https://mail.gna.org/listinfo/xenomai-help

Reply via email to