All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ignacio García Pérez" <iggarpe@domain.hid>
To: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Application broken 2.3.4 ---> 2.4.0
Date: Tue, 11 Dec 2007 13:04:10 +0100	[thread overview]
Message-ID: <475E7CBA.7060300@domain.hid> (raw)
In-Reply-To: <475E76A0.4010007@domain.hid>

Ignacio García Pérez escribió:

Ok, replying myself with further findings:

It turns out that the following code miserably fails to set the thread 
periodic:

rt_task_set_periodic(&_blink_thread, rt_timer_read(), mili2count(250));

Where this actually works:

rt_task_set_periodic(&_blink_thread, TM_NOW, mili2count(250));

Which makes me think that rt_task_set_periodic() fails when the passed 
idate is in the past.

And you may say: why the hell do you use rt_timer_read() when you can 
use TM_NOW ???

Well, I think that rt_task_set_periodic should word (AND DID) both ways, 
but actually I have a very good reason to (sometimes) use an idate in 
the past: I want the blinking synchronized to the "event" as closely as 
possible. If there is a delay D from my recorded time for the event to 
the actual call to rt_task_set_periodic, I can:

a) Use rt_task_set_periodic(TM_NOD)

b) Use rt_task_set_periodic(recorded_time)

In the first case there will be a delay of D from every period to the 
"event", while in the second case that delay will be only in the FIRST 
execution of the periodic task.

Anyway, something is truly screwed up when 
rt_task_set_periodic(&_blink_thread, rt_timer_read(), mili2count(250)) 
fails to make the task periodic...

> Hi,
>
> I've compiled a previously 100% working application under the new 2.4.0 
> release and found the following issues:
>
>
> 1- rt_task_set_periodic does not work sometimes?
>
> In this application I have a periodic task (250ms period) which is used 
> to blink some lights. The blinking is occasionally resynchronized to 
> some external event, and this is what I do:
>
> In the periodic task:
>
> blink_count = 0;
> rt_task_set_periodic();
> for (;;) {
>     whatever();
>     blink_count = (blink_count + 1) & 3;
>     rt_task_wait_period();
> }
>
> Some somewhere else, when I want to synchronize the blinking:
>
>     blink_count = 0;
>     rt_task_set_periodic();
>
> This has worked perfectly until version 2.4.0. It seems that further 
> calls to rt_task_set_periodic (from a different task) break the 
> periodicity (the periodic task enters rt_task_wait_period() and never 
> leaves again).
>
> Any clues?
>   



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

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-11 11:38 [Xenomai-help] Application broken 2.3.4 ---> 2.4.0 Ignacio García Pérez
2007-12-11 12:04 ` Ignacio García Pérez [this message]
2007-12-11 12:16   ` Jan Kiszka
2007-12-11 12:58     ` Ignacio García Pérez
2007-12-11 13:16     ` Ignacio García Pérez
2007-12-11 13:41       ` Gilles Chanteperdrix
2007-12-11 15:17         ` Ignacio García Pérez
2007-12-11 16:41           ` Gilles Chanteperdrix
     [not found]             ` <47624674.5070107@domain.hid>
2007-12-14  9:46               ` Gilles Chanteperdrix
2007-12-14 17:06                 ` Ignacio García Pérez
2007-12-14 19:01                   ` Gilles Chanteperdrix

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=475E7CBA.7060300@domain.hid \
    --to=iggarpe@domain.hid \
    --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.