[PATCH] eal/windows: fix data race when creating threads
Tyler Retzlaff
roretzla at linux.microsoft.com
Thu Mar 10 08:35:08 CET 2022
create lcore worker threads suspended and then subsequently resume to
allow &lcore_config[i].thread_id be stored before eal_thread_loop
execution.
Fixes: 53ffd9f080fc ("eal/windows: add minimum viable code")
Cc: anand.rawat at intel.com
Cc: stable at dpdk.org
Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
lib/eal/windows/eal_thread.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/eal/windows/eal_thread.c b/lib/eal/windows/eal_thread.c
index 54fa93f..ff84cb4 100644
--- a/lib/eal/windows/eal_thread.c
+++ b/lib/eal/windows/eal_thread.c
@@ -150,13 +150,18 @@
th = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE)(ULONG_PTR)eal_thread_loop,
- NULL, 0, (LPDWORD)thread);
+ NULL, CREATE_SUSPENDED, (LPDWORD)thread);
if (!th)
return -1;
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
SetThreadPriority(th, THREAD_PRIORITY_NORMAL);
+ if (ResumeThread(th) == (DWORD)-1) {
+ (void)CloseHandle(th);
+ return -1;
+ }
+
return 0;
}
--
1.8.3.1
More information about the stable
mailing list