From: Wolfgang Grandegger <wg@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai-help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] pthread cancelation and scheduling magics
Date: Mon, 01 Dec 2008 14:31:18 +0100 [thread overview]
Message-ID: <4933E726.3090906@domain.hid> (raw)
In-Reply-To: <49330CD3.4090700@domain.hid>
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,
prev parent reply other threads:[~2008-12-01 13:31 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-30 21:34 [Xenomai-help] pthread cancelation and scheduling magics Wolfgang Grandegger
2008-11-30 21:46 ` Gilles Chanteperdrix
2008-11-30 21:59 ` Gilles Chanteperdrix
2008-12-01 10:22 ` Gilles Chanteperdrix
2008-12-01 14:16 ` Wolfgang Grandegger
2008-12-01 14:15 ` Gilles Chanteperdrix
2008-12-01 15:10 ` Gilles Chanteperdrix
2008-12-02 15:59 ` Wolfgang Grandegger
2008-12-02 15:55 ` Gilles Chanteperdrix
2008-12-02 18:18 ` Wolfgang Grandegger
2008-12-02 18:35 ` Gilles Chanteperdrix
2008-12-02 19:50 ` Wolfgang Grandegger
2008-12-02 20:03 ` Philippe Gerum
2008-12-07 16:05 ` Wolfgang Grandegger
2008-12-10 11:16 ` Wolfgang Grandegger
2008-12-11 15:26 ` Jan Kiszka
2008-12-13 15:55 ` Wolfgang Grandegger
2009-01-01 13:34 ` Gilles Chanteperdrix
2009-01-01 17:07 ` Philippe Gerum
2009-01-01 18:00 ` Gilles Chanteperdrix
2009-01-09 13:08 ` Gilles Chanteperdrix
2009-01-09 13:38 ` Philippe Gerum
2009-01-01 17:10 ` Wolfgang Grandegger
2009-01-01 18:11 ` Gilles Chanteperdrix
2008-12-03 10:16 ` Gilles Chanteperdrix
2008-12-03 11:19 ` Wolfgang Grandegger
2008-12-03 13:30 ` Gilles Chanteperdrix
2008-12-03 18:02 ` Wolfgang Grandegger
2008-12-03 17:57 ` Gilles Chanteperdrix
2008-12-03 18:37 ` Wolfgang Grandegger
2008-12-03 18:32 ` Gilles Chanteperdrix
2008-12-03 18:55 ` Wolfgang Grandegger
2008-12-03 18:55 ` Gilles Chanteperdrix
2008-12-03 19:19 ` Wolfgang Grandegger
2008-12-03 19:19 ` Gilles Chanteperdrix
2008-12-03 20:02 ` Wolfgang Grandegger
2008-12-03 20:02 ` Gilles Chanteperdrix
2008-12-04 15:29 ` Wolfgang Grandegger
2008-12-04 15:38 ` Gilles Chanteperdrix
2008-12-04 15:42 ` Gilles Chanteperdrix
2008-12-04 16:31 ` Wolfgang Grandegger
2008-12-04 16:26 ` Gilles Chanteperdrix
2008-12-04 16:49 ` Wolfgang Grandegger
2008-12-04 17:02 ` Gilles Chanteperdrix
2008-12-04 17:52 ` Wolfgang Grandegger
2008-12-04 17:51 ` Gilles Chanteperdrix
2008-12-05 14:58 ` Wolfgang Grandegger
2008-12-03 8:04 ` Wolfgang Grandegger
2008-12-03 10:12 ` Gilles Chanteperdrix
2008-12-03 10:46 ` Wolfgang Grandegger
2008-12-03 10:40 ` Gilles Chanteperdrix
2008-12-03 11:16 ` Wolfgang Grandegger
2008-12-03 11:11 ` Philippe Gerum
2008-12-03 11:22 ` Wolfgang Grandegger
2008-12-01 13:31 ` Wolfgang Grandegger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4933E726.3090906@domain.hid \
--to=wg@domain.hid \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.