1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Intel Corporation
7 #include <rte_atomic.h>
9 #include <rte_launch.h>
10 #include <rte_lcore.h>
11 #include <rte_per_lcore.h>
12 #include <rte_common.h>
13 #include <rte_memory.h>
15 #include "eal_private.h"
16 #include "eal_thread.h"
17 #include "eal_windows.h"
20 eal_thread_wake_worker(unsigned int worker_id)
22 int m2w = lcore_config[worker_id].pipe_main2worker[1];
23 int w2m = lcore_config[worker_id].pipe_worker2main[0];
28 n = _write(m2w, &c, 1);
29 } while (n == 0 || (n < 0 && errno == EINTR));
31 rte_panic("cannot write on configuration pipe\n");
34 n = _read(w2m, &c, 1);
35 } while (n < 0 && errno == EINTR);
37 rte_panic("cannot read on configuration pipe\n");
41 eal_thread_wait_command(void)
43 unsigned int lcore_id = rte_lcore_id();
48 m2w = lcore_config[lcore_id].pipe_main2worker[0];
50 n = _read(m2w, &c, 1);
51 } while (n < 0 && errno == EINTR);
53 rte_panic("cannot read on configuration pipe\n");
57 eal_thread_ack_command(void)
59 unsigned int lcore_id = rte_lcore_id();
64 w2m = lcore_config[lcore_id].pipe_worker2main[1];
66 n = _write(w2m, &c, 1);
67 } while (n == 0 || (n < 0 && errno == EINTR));
69 rte_panic("cannot write on configuration pipe\n");
72 /* function to create threads */
74 eal_thread_create(pthread_t *thread, unsigned int lcore_id)
78 th = CreateThread(NULL, 0,
79 (LPTHREAD_START_ROUTINE)(ULONG_PTR)eal_thread_loop,
80 (LPVOID)(uintptr_t)lcore_id,
86 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
87 SetThreadPriority(th, THREAD_PRIORITY_NORMAL);
89 if (ResumeThread(th) == (DWORD)-1) {
90 (void)CloseHandle(th);
97 /* get current thread ID */
101 return GetCurrentThreadId();
105 rte_thread_setname(__rte_unused pthread_t id, __rte_unused const char *name)
108 /* This is a stub, not the expected result */