[PATCH] eal: provide per lcore macros for MSVC

Thomas Monjalon thomas at monjalon.net
Tue Jul 11 08:25:47 CEST 2023


10/07/2023 23:29, Tyler Retzlaff:
> Provide per lcore macros that use __declspec(thread) and uses C23
> typeof.
> 
> Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> ---
> +#ifndef RTE_TOOLCHAIN_MSVC
>  /**
>   * Macro to define a per lcore variable "var" of type "type", don't
>   * use keywords like "static" or "volatile" in type, just prefix the
> @@ -37,6 +38,13 @@
>   */
>  #define RTE_DECLARE_PER_LCORE(type, name)			\
>  	extern __thread __typeof__(type) per_lcore_##name
> +#else
> +#define RTE_DEFINE_PER_LCORE(type, name)			\
> +	__declspec(thread) typeof(type) per_lcore_##name
> +
> +#define RTE_DECLARE_PER_LCORE(type, name)			\
> +	extern __declspec(thread) typeof(type) per_lcore_##name
> +#endif

It would be better (here and in other MSVC patches)
to have the opposite logic: start with MSVC implementation.

#ifdef MSVC
	MSVC implementation
#else
	POSIX implementation
#endif




More information about the dev mailing list