MEYLAN Jean-philippe wrote:
> Hello,
> 
> I'm working on the creation of a Xenomai target for Mathwork's
> Real Time Workshop. In order to achieve this, I would like to 
> control the execution rate of a task with a semaphore periodically
> released by an alarm handler. The tasks does nothing else but waiting
> (in a loop) on the semaphore. If the task can immediately take 
> the sempahore, it means that the rate is too fast for it because
> the semaphore has been released before the end of its current iteration.

Some more efficient way is to let the thread monitor its execution time
and derive the next wakeup date from it. Think of:

next_wakeup = now();
do_forever
        next_wakeup += period;
        do_some_rt_job();
        if next_wakeup >= now() then
                handle_overload()
        sleep_until(next_wakeup)

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to