[PATCH v4 2/2] eal: fix failure path race setting new thread affinity

Stephen Hemminger stephen at networkplumber.org
Wed Mar 15 02:20:42 CET 2023


On Tue, 14 Mar 2023 15:50:39 -0700
Tyler Retzlaff <roretzla at linux.microsoft.com> wrote:

> +	/* Wait for the thread wrapper to initialize thread successfully */
> +	while ((thread_wrapper_status =
> +		__atomic_load_n(&ctx->thread_wrapper_status,
> +		__ATOMIC_ACQUIRE)) == THREAD_WRAPPER_LAUNCHING)
> +		sched_yield();

Using pthread condition variable would be better, and avoid
using sched_yield() which is deprecated and not guaranteed to
work in cases where threads have different priority.


More information about the stable mailing list