All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] How to cancel a Xenomai POSIX thread
Date: Tue, 11 Dec 2007 15:39:29 +0100	[thread overview]
Message-ID: <475EA121.2020809@domain.hid> (raw)
In-Reply-To: <2ff1a98a0712110523tb0d23f0tdfa8b3778ae634fc@domain.hid>

Gilles Chanteperdrix wrote:
> On Dec 11, 2007 2:20 PM, Wolfgang Grandegger <wg@domain.hid> wrote:
>> Wolfgang Grandegger wrote:
>>> The attached test application using a more sophisticated signal handling
>>> works fine on my MPC5200-board running Linux 2.6.23 and Xenomai trunk.
>>> Going to try it tomorrow on my PC.
>> It works fine as well on my PC with Linux 2.6.23 and Xenomai trunk and
>> now also with Linux 2.4.25 and Xenomai 2.3.x :-). Just to understand it
>> right: The task signaled with pthread_kill() will be suspended and
>> switches to secondary mode if it was running in primary mode. The signal
>> will then be handled by Linux as usual. When the task resumes, does it
>> get switched back to primary mode automatically?
> 
> No, it will get swtiched back to primary mode only if it calls a
> service needing primary mode.

OK.

>> Great, the only open issue is why executing init_task() switches to
>> secondary mode resulting in period overruns in high_prio_task(). Is that
>> obvious to you?
> 
> init_task calls pthread_create, which needs running in secondary mode
> to create a thread. We can not create a task without help from
> secondary mode.

OK.

I was a bit quick with my assumption that it works with 2.4. It actually
only works, if I have a pthread_set_mode_np() in the while loop of the
primary task:

        while (1) {
		pthread_set_mode_np(0, PTHREAD_PRIMARY);
                count++;
        }

Without pthread_set_mode_np(), the system hangs after the following
output lines:

  bash-2.05b# ./kill_pthread2
  Starting high_prio_task
  low_prio_task: policy=1 prio=5
  SIGUSER1 to id_low: count=17497245, overruns=0

It seems to hang when the low_prio_task() calls pthread_wait_np()
thereafter. Any quick idea where the problem is?

Wolfgang.



  reply	other threads:[~2007-12-11 14:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-06 12:31 [Xenomai-core] How to cancel a Xenomai POSIX thread Wolfgang Grandegger
2007-12-06 13:13 ` Gilles Chanteperdrix
2007-12-06 13:24   ` Wolfgang Grandegger
2007-12-06 13:28     ` Gilles Chanteperdrix
2007-12-06 13:44       ` Gilles Chanteperdrix
2007-12-06 14:05         ` Wolfgang Grandegger
2007-12-06 14:21           ` Gilles Chanteperdrix
2007-12-07 14:03             ` Wolfgang Grandegger
2007-12-07 21:23               ` Gilles Chanteperdrix
2007-12-07 22:10                 ` Gilles Chanteperdrix
2007-12-09 21:55                   ` Wolfgang Grandegger
2007-12-09 22:52                     ` Gilles Chanteperdrix
2007-12-10  7:27                       ` Wolfgang Grandegger
2007-12-10 15:20                       ` Wolfgang Grandegger
2007-12-10 15:55                         ` Gilles Chanteperdrix
2007-12-10 21:39                           ` Wolfgang Grandegger
2007-12-10 21:46                             ` Wolfgang Grandegger
2007-12-11 13:20                               ` Wolfgang Grandegger
2007-12-11 13:23                                 ` Gilles Chanteperdrix
2007-12-11 14:39                                   ` Wolfgang Grandegger [this message]
2007-12-11 19:59                                     ` Gilles Chanteperdrix
2007-12-12  7:56                                       ` Wolfgang Grandegger
2007-12-12  9:07                                         ` Gilles Chanteperdrix
2007-12-12  9:59                                           ` Wolfgang Grandegger
2007-12-12 20:08                                             ` Gilles Chanteperdrix
2007-12-12 21:00                                               ` Wolfgang Grandegger
2007-12-12 21:48                                                 ` Gilles Chanteperdrix
2007-12-10 21:56                             ` Gilles Chanteperdrix
2007-12-10 21:21                         ` Gilles Chanteperdrix
2007-12-10 21:37                           ` Wolfgang Grandegger
2007-12-10 22:11                         ` Gilles Chanteperdrix
2007-12-11  7:45                           ` Wolfgang Grandegger
2007-12-06 13:47       ` Wolfgang Grandegger

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=475EA121.2020809@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.