From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4762B80F.3020804@domain.hid> Date: Fri, 14 Dec 2007 18:06:23 +0100 From: =?ISO-8859-1?Q?Ignacio_Garc=EDa_P=E9rez?= MIME-Version: 1.0 References: <475E76A0.4010007@domain.hid> <475E7CBA.7060300@domain.hid> <475E7F84.1040600@domain.hid> <475E8DAE.9070405@domain.hid> <2ff1a98a0712110541x12633fa3yb311214d9d0245a1@domain.hid> <475EA9F4.3020306@domain.hid> <2ff1a98a0712110841y7d16bb2esfca8fdfd7419ea5e@domain.hid> <47624674.5070107@domain.hid> <2ff1a98a0712140146o2a3c5761i8a97d67921fedecd@domain.hid> In-Reply-To: <2ff1a98a0712140146o2a3c5761i8a97d67921fedecd@domain.hid> Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai-help] Application broken 2.3.4 ---> 2.4.0 List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gilles Chanteperdrix Cc: xenomai-help
immediate execution while in 2.4.0 it is not.
    

I do not see this in 2.3.4 code, but let's admit it is true: then
v2.3.4 code is broken, and so is your application. Really, no RTOS
allows starting timers with dates in the past, you can check the
various Xenomai skins implementation or the posix spec. So, our advice
is to fix your application.

  

I agree it makes no sense to start a timer in the past, but we are not talking about a timer, but about a task.

The discussion is: I want to make a task periodic starting a "little while" ago, what should the rt_task_set_periodic do:

a) Fail and do nothing about the task (actually it will stop it if it was already periodic !!!).

b) Fail, but schedule the task for immediate execution and set it periodic starting at the specified date plus a period multiple such that the result is in the future.

Not only it seems to me that (b) makes more sense and does something actually useful, but also I think there is no way I can do the equivalent in an atomic way in the application code (I mean without resorting to non-native API functions).

I might be wrong, and if so, I'll really appreciate an example of how do to that. Atomically. Meanwhile this is the only thing I could come up with:

while ((r = rt_task_set_periodic(&mytask, start, period)) == -ETIMEDOUT) {
    count++; start += period;
}
if (count > 0) rt_task_resume(&mytask);

That code, would however have a non-desirable effect under certain circumstances: let's assume that I want a task A executed, rather than every T milliseconds, N times per second. If the "master" if both tasks are prevented from executing by some other task with higher priority for a large amount of time larger than several periods, several executions would be skipped, which may not be the best solution (maybe I'd rather have the task A execute its processing loop severan times nonstop until it "cathes up" with the total expected number of executions).

And now that I think about it, ¿what happens to a periodic task when it is prevented from executing by some other higher priority task for an interval equivalent to several periods?

Regards.

Nacho.