<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 27, 2023 at 4:05 PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 27.06.23 22:18, Kinsey Moore wrote:<br>
> diff --git a/c-user/task/directives.rst b/c-user/task/directives.rst<br>
> index c082b51..3334679 100644<br>
> --- a/c-user/task/directives.rst<br>
> +++ b/c-user/task/directives.rst<br>
> @@ -1475,15 +1475,15 @@ The following constraints apply to this directive:<br>
>       \clearpage<br>
>   <br>
>   .. index:: rtems_task_wake_after()<br>
> -.. index:: delay a task for an interval<br>
> -.. index:: wake up after an interval<br>
> +.. index:: delay a task for a number of ticks<br>
> +.. index:: wake up after a number of ticks<br>
>   <br>
>   .. _InterfaceRtemsTaskWakeAfter:<br>
>   <br>
>   rtems_task_wake_after()<br>
>   -----------------------<br>
>   <br>
> -Wakes up after an interval in :term:`clock ticks <clock tick>` or yields the<br>
> +Wakes up after a number of :term:`clock ticks <clock tick>` or yields the<br>
>   processor.<br>
>   <br>
>   .. rubric:: CALLING SEQUENCE:<br>
> @@ -1502,10 +1502,12 @@ processor.<br>
>   <br>
>   This directive blocks the calling task for the specified ``ticks`` of clock<br>
>   ticks if the value is not equal to :c:macro:`RTEMS_YIELD_PROCESSOR`.  When the<br>
> -requested interval has elapsed, the task is made ready.  The clock tick<br>
> +requested number of ticks has elapsed, the task is made ready.  The clock tick<br>
>   directives automatically updates the delay period.  The calling task may give<br>
>   up the processor and remain in the ready state by specifying a value of<br>
> -:c:macro:`RTEMS_YIELD_PROCESSOR` in ``ticks``.<br>
> +:c:macro:`RTEMS_YIELD_PROCESSOR` in ``ticks``.  Applications requiring use of a<br>
> +time base instead of system ticks should make use of ``nanosleep()`` or<br>
> +``clock_nanosleep()``.<br>
<br>
What is a time base?<br></blockquote><div><br></div><div>A delay specified in some subunit of seconds instead of clock ticks. <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
nanosleep() has the same issues as rtems_task_wake_after(). If you want <br>
to wait for fixed intervals, then you have to use clock_nanosleep() with <br>
TIMER_ABSTIME and CLOCK_MONOTONIC.<br>
<br>
The wording with the interval is not really wrong. Only the clock <br>
resolution is a bit coarse (clock ticks). I guess the real problem is <br>
that if you want to implement a periodic task with<br>
<br>
while (1) {<br>
        f();<br>
        rtems_task_wake_after(period);<br>
}<br>
<br>
then this doesn't work if the time between calls to <br>
rtems_task_wake_after() varies within the range of clock ticks. This can <br>
be fixed by using clock_nanosleep() with TIMER_ABSTIME and CLOCK_MONOTONIC.<br></blockquote><div><br></div><div>The issue with specifying "interval" is that "time interval" is a common phrase in general and a clock tick can vary depending on application configuration. While the use of "interval" isn't necessarily wrong, "time interval" is very misleading in this context and could easily be assumed. Would "clock tick interval" be reasonable for clarity as a way to distance the verbiage from "time interval"?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
>   <br>
>   .. rubric:: RETURN VALUES:<br>
>   <br>
<br>
Could you please update<br>
<br>
<a href="https://git.rtems.org/rtems-central/tree/spec/rtems/task/if/wake-after.yml" rel="noreferrer" target="_blank">https://git.rtems.org/rtems-central/tree/spec/rtems/task/if/wake-after.yml</a><br>
<br>
since this will keep also the Doxygen up to date.<br>
<br>
For clock_nanosleep() references, use ${/c/if/clock-nanosleep:/name}.<br></blockquote><div><br></div><div>Will do.</div><div><br></div><div>Kinsey <br></div></div></div>