> 
> +/*
> + * Wait until a lcore finished its job by pthread condition.
> + */
> +int
> +rte_eal_wait_lcore_sleep(unsigned slave_id)
> +{
> +     if (lcore_config[slave_id].state == WAIT)
> +             return 0;
> +
> +     pthread_mutex_lock(&rte_eal_thread_mutex[slave_id]);
> +     while (lcore_config[slave_id].state != WAIT &&
> +            lcore_config[slave_id].state != FINISHED)
> +             pthread_cond_wait(&rte_eal_thread_cond[slave_id],
> +                             &rte_eal_thread_mutex[slave_id]);
> +     pthread_mutex_unlock(&rte_eal_thread_mutex[slave_id]);
> +
> +     /* we are in finished state, go to wait state */
> +     lcore_config[slave_id].state = WAIT;
> +     return lcore_config[slave_id].ret;
> +}
> +

Actually, another question - could that 2 or more threads wait for the same 
core simultaneously?
If yes, then 2-nd thread in that function might stuck forever.
In that case it is better to use cond_timed_wait() here and cond_broadcast() 
above.
Konstantin

Reply via email to