On 22 December 2014 at 14:10, Savolainen, Petri (NSN - FI/Espoo)
<petri.savolai...@nsn.com> wrote:
>
>
> Because the thread will exit the schedule loop, it has to pause first and
> then run sched loop until the potential per thread local scheduler cache is
> empty (see under).
In this specific case, the example terminates when the specified
number of timeouts have been received and processed. There is no need
to pause the scheduler and drain any prescheduled buffers because when
the remain counter reaches zero, all threads are done and should
terminate.

This is a timer example, not a scheduler example. For a scheduler
example, we should demonstrate the proper usage of
odp_scheduler_pause() and resume.


>
>
>
> -Petri
>
>
>
>                int done = 0;
>
>
>
>                while (1) {
>
>                               odp_timeout_t tmo;
>
>
>
>                               if (done)
>
> buf = odp_schedule(&queue, ODP_SCHED_NO_WAIT);
>
>                               else
>
>                                              buf = odp_schedule(&queue,
> ODP_SCHED_WAIT);
>
>
>
>                               if (buf == ODP_BUFFER_INVALID)
>
>                                              break;
>
>
>
>                               tmo  = odp_timeout_from_buffer(buf);
>
>                               tick = odp_timeout_tick(tmo);
>
>
>
>                               EXAMPLE_DBG("  [%i] timeout, tick
> %"PRIu64"\n", thr, tick);
>
>
>
>                               odp_buffer_free(buf);
>
>
>
>                               num--;
>
>
>
>                               if (num == 0) {
>
>                                              odp_schedule_pause();
>
>                                              done = 1;
>
>                                              continue;
>
> }
>
>
>
>                               tick += period;
>
>
>
>                               odp_timer_absolute_tmo(test_timer, tick,
>
>                                                                    queue,
> ODP_BUFFER_INVALID);
>
>                }
>
>
>
>
>
> From: lng-odp-boun...@lists.linaro.org
> [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext Bill Fischofer
> Sent: Friday, December 19, 2014 10:38 PM
> To: Mike Holmes
> Cc: lng-odp-forward
> Subject: Re: [lng-odp] [PATCH v2 2/3] example: odp_timer_test: remove use of
> odp_schdule_one
>
>
>
> Typo in the title (odp_schdule_one).  Presumably Maxim can fix during merge?
>
>
>
> On Fri, Dec 19, 2014 at 2:34 PM, Mike Holmes <mike.hol...@linaro.org> wrote:
>
> Signed-off-by: Mike Holmes <mike.hol...@linaro.org>
> ---
>  example/timer/odp_timer_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index 0d6e31a..6d2609a 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -84,7 +84,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
>         while (1) {
>                 odp_timeout_t tmo;
>
> -               buf = odp_schedule_one(&queue, ODP_SCHED_WAIT);
> +               buf = odp_schedule(&queue, ODP_SCHED_WAIT);
>
>                 tmo  = odp_timeout_from_buffer(buf);
>                 tick = odp_timeout_tick(tmo);
> --
> 2.1.0
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to