[PATCH v2] eal: provide per lcore macros for MSVC
Tyler Retzlaff
roretzla at linux.microsoft.com
Tue Jul 11 17:52:27 CEST 2023
Provide per lcore macros that use __declspec(thread) and uses C23
typeof.
Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
lib/eal/include/rte_per_lcore.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/eal/include/rte_per_lcore.h b/lib/eal/include/rte_per_lcore.h
index eaedf0c..2b846f9 100644
--- a/lib/eal/include/rte_per_lcore.h
+++ b/lib/eal/include/rte_per_lcore.h
@@ -24,19 +24,27 @@
#include <pthread.h>
+#ifdef 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
* whole macro.
*/
#define RTE_DEFINE_PER_LCORE(type, name) \
- __thread __typeof__(type) per_lcore_##name
+ __declspec(thread) typeof(type) per_lcore_##name
/**
* Macro to declare an extern per lcore variable "var" of type "type"
*/
#define RTE_DECLARE_PER_LCORE(type, name) \
+ extern __declspec(thread) typeof(type) per_lcore_##name
+#else
+#define RTE_DEFINE_PER_LCORE(type, name) \
+ __thread __typeof__(type) per_lcore_##name
+
+#define RTE_DECLARE_PER_LCORE(type, name) \
extern __thread __typeof__(type) per_lcore_##name
+#endif
/**
* Read/write the per-lcore variable value
--
1.8.3.1
More information about the dev
mailing list