* [Xenomai] How to use timer services without switching to secondary mode?
@ 2015-07-23 8:07 Giorgio Buffa
2015-07-23 8:39 ` Philippe Gerum
0 siblings, 1 reply; 2+ messages in thread
From: Giorgio Buffa @ 2015-07-23 8:07 UTC (permalink / raw)
To: xenomai
Hello list!
I have to write a Xenomai 2.6.4 thread that is activated upon the
expiration of a (periodic) timer. It is not clear to me how to do that
without switching to secondary mode.
I would like to stick with the POSIX skin but, in my understanding, with
the POSIX skin, using the `timer_create()` and `timer_settime()` I will
switch to secondary mode on timer expiration, because a signal is
generated by that event. Is it correct?
On the other hand, the switching to secondary mode does not happens
using the Native Xenomai API, i.e. `rt_alarm_create()` and
`rt_alarm_start()`. Am I wrong?
What are the options available for that purpose? Should I use the
`pthread_make_periodic_np()` instead? What are the differences wrt
`timer_*` calls?
Thank you for the support and kind regards,
Giorgio B.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Xenomai] How to use timer services without switching to secondary mode?
2015-07-23 8:07 [Xenomai] How to use timer services without switching to secondary mode? Giorgio Buffa
@ 2015-07-23 8:39 ` Philippe Gerum
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2015-07-23 8:39 UTC (permalink / raw)
To: Giorgio Buffa, xenomai
On 07/23/2015 10:07 AM, Giorgio Buffa wrote:
> Hello list!
> I have to write a Xenomai 2.6.4 thread that is activated upon the
> expiration of a (periodic) timer. It is not clear to me how to do that
> without switching to secondary mode.
>
> I would like to stick with the POSIX skin but, in my understanding, with
> the POSIX skin, using the `timer_create()` and `timer_settime()` I will
> switch to secondary mode on timer expiration, because a signal is
> generated by that event. Is it correct?
>
Yes, as far as Xenomai 2.x is concerned, the thread receiving the wake
up (linux) signal will be switched to secondary mode. Support for rt
signals appeared in 3.x, delivered to sigwait*() or via the timerfd API.
> On the other hand, the switching to secondary mode does not happens
> using the Native Xenomai API, i.e. `rt_alarm_create()` and
> `rt_alarm_start()`. Am I wrong?
>
No, that is correct. There is an internal server thread waiting for
pending alarms in primary mode.
> What are the options available for that purpose? Should I use the
> `pthread_make_periodic_np()` instead?
Yes, if you need periodic timing with automatic reporting of overruns
via the POSIXish API of Xenomai 2.x. Or clock_nanosleep() with absolute
timing on CLOCK_MONOTONIC if you intend to detect overruns by yourself.
What are the differences wrt
> `timer_*` calls?
>
async vs sync delivery, non-rt vs rt on the wake up side. The existing
documentation about the services should help:
http://www.xenomai.org/documentation/xenomai-2.6/html/api/group__posix.html
--
Philippe.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-23 8:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 8:07 [Xenomai] How to use timer services without switching to secondary mode? Giorgio Buffa
2015-07-23 8:39 ` Philippe Gerum
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.