From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 6/6] windows: remove most pthread lifetime shim functions
Date: Fri, 17 Mar 2023 15:34:20 -0700 [thread overview]
Message-ID: <1679092460-9930-7-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1679092460-9930-1-git-send-email-roretzla@linux.microsoft.com>
Remove most of the pthread_xxx lifetime shim functions, only
pthread_create remains while we wait for rte_ctrl_thread_create removal.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
lib/eal/windows/include/pthread.h | 99 ---------------------------------------
1 file changed, 99 deletions(-)
diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h
index f7cf0e9..051b931 100644
--- a/lib/eal/windows/include/pthread.h
+++ b/lib/eal/windows/include/pthread.h
@@ -42,92 +42,6 @@
!DeleteSynchronizationBarrier(barrier)
#define pthread_cancel(thread) !TerminateThread((HANDLE) thread, 0)
-/* pthread function overrides */
-#define pthread_self() \
- ((pthread_t)GetCurrentThreadId())
-
-
-static inline int
-pthread_equal(pthread_t t1, pthread_t t2)
-{
- return t1 == t2;
-}
-
-static inline int
-pthread_setaffinity_np(pthread_t threadid, size_t cpuset_size,
- rte_cpuset_t *cpuset)
-{
- DWORD_PTR ret = 0;
- HANDLE thread_handle;
-
- if (cpuset == NULL || cpuset_size == 0)
- return -1;
-
- thread_handle = OpenThread(THREAD_ALL_ACCESS, FALSE, threadid);
- if (thread_handle == NULL) {
- RTE_LOG_WIN32_ERR("OpenThread()");
- return -1;
- }
-
- ret = SetThreadAffinityMask(thread_handle, *cpuset->_bits);
- if (ret == 0) {
- RTE_LOG_WIN32_ERR("SetThreadAffinityMask()");
- goto close_handle;
- }
-
-close_handle:
- if (CloseHandle(thread_handle) == 0) {
- RTE_LOG_WIN32_ERR("CloseHandle()");
- return -1;
- }
- return (ret == 0) ? -1 : 0;
-}
-
-static inline int
-pthread_getaffinity_np(pthread_t threadid, size_t cpuset_size,
- rte_cpuset_t *cpuset)
-{
- /* Workaround for the lack of a GetThreadAffinityMask()
- *API in Windows
- */
- DWORD_PTR prev_affinity_mask;
- HANDLE thread_handle;
- DWORD_PTR ret = 0;
-
- if (cpuset == NULL || cpuset_size == 0)
- return -1;
-
- thread_handle = OpenThread(THREAD_ALL_ACCESS, FALSE, threadid);
- if (thread_handle == NULL) {
- RTE_LOG_WIN32_ERR("OpenThread()");
- return -1;
- }
-
- /* obtain previous mask by setting dummy mask */
- prev_affinity_mask = SetThreadAffinityMask(thread_handle, 0x1);
- if (prev_affinity_mask == 0) {
- RTE_LOG_WIN32_ERR("SetThreadAffinityMask()");
- goto close_handle;
- }
-
- /* set it back! */
- ret = SetThreadAffinityMask(thread_handle, prev_affinity_mask);
- if (ret == 0) {
- RTE_LOG_WIN32_ERR("SetThreadAffinityMask()");
- goto close_handle;
- }
-
- memset(cpuset, 0, cpuset_size);
- *cpuset->_bits = prev_affinity_mask;
-
-close_handle:
- if (CloseHandle(thread_handle) == 0) {
- RTE_LOG_WIN32_ERR("SetThreadAffinityMask()");
- return -1;
- }
- return (ret == 0) ? -1 : 0;
-}
-
static inline int
pthread_create(void *threadid, const void *threadattr, void *threadfunc,
void *args)
@@ -145,19 +59,6 @@
}
static inline int
-pthread_detach(__rte_unused pthread_t thread)
-{
- return 0;
-}
-
-static inline int
-pthread_join(__rte_unused pthread_t thread,
- __rte_unused void **value_ptr)
-{
- return 0;
-}
-
-static inline int
pthread_mutex_init(pthread_mutex_t *mutex,
__rte_unused pthread_mutexattr_t *attr)
{
--
1.8.3.1
next prev parent reply other threads:[~2023-03-17 22:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 22:34 [PATCH 0/6] " Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 1/6] dma/skeleton: use rte thread API Tyler Retzlaff
2023-04-18 9:19 ` Bruce Richardson
2023-04-18 15:04 ` Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 2/6] net/ixgbe: " Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 3/6] net/ice: " Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 4/6] net/iavf: " Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 5/6] eal: " Tyler Retzlaff
2023-03-17 22:34 ` Tyler Retzlaff [this message]
2023-04-03 5:34 ` [PATCH 0/6] windows: remove most pthread lifetime shim functions Tyler Retzlaff
2023-04-18 9:21 ` Bruce Richardson
2023-06-01 8:49 ` David Marchand
2023-06-01 12:23 ` Zhang, Qi Z
2023-06-02 16:22 ` Tyler Retzlaff
2023-06-09 12:38 ` David Marchand
2023-04-17 16:46 ` Tyler Retzlaff
2023-06-09 12:39 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1679092460-9930-7-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).