On Thu, 11 Oct 2018 20:57:52 +0100
Ferruh Yigit <ferruh.yi...@intel.com> wrote:
> +/*
> + * Wait until a lcore finished its job by sleeping.
> + * Sleep time will be times of 'usec'
> + */
> +int
> +rte_eal_wait_lcore_sleep(unsigned slave_id, size_t usec)
> +{
> +     if (lcore_config[slave_id].state == WAIT)
> +             return 0;
> +
> +     while (lcore_config[slave_id].state != WAIT &&
> +            lcore_config[slave_id].state != FINISHED)
> +                     usleep(usec);
> +
> +     rte_rmb();
> +
> +     /* we are in finished state, go to wait state */
> +     lcore_config[slave_id].state = WAIT;
> +     return lcore_config[slave_id].ret;
> +}
> +

Since lcore threads are really pthreads you could avoid doing polling by
using a pthread condition (ie. pthread_cond_wait and/or pthread_cond_timedwait)

Reply via email to