On Mon,  3 Sep 2018 17:47:42 +0300
Ilya Maximets <i.maxim...@samsung.com> wrote:

>  
> +void __rte_experimental
> +rte_delay_us_sleep(unsigned int us)
> +{
> +     struct timespec wait[2];
> +     int ind = 0;
> +
> +     wait[0].tv_sec = 0;
> +     if (us >= US_PER_S) {
> +             wait[0].tv_sec = us / US_PER_S;
> +             us -= wait[0].tv_sec * US_PER_S;
> +     }
> +     wait[0].tv_nsec = 1000 * us;
> +
> +     while (nanosleep(&wait[ind], &wait[1 - ind]) == EINTR)
> +             ind = 1 - ind;
> +}
> +

This seems like a complex/tricky way to handle the case where
nanosleep is interrupted. It needs a comment.

Reply via email to