Re: [dpdk-dev] [PATCH v9 07/10] eal: implement functions for mutex management
From: Dmitry Kozlyuk <hidden>
Date: 2021-06-08 23:04:33
2021-06-04 16:44 (UTC-0700), Narcisa Ana Maria Vasile: [...]
quoted hunk ↗ jump to hunk
diff --git a/lib/eal/include/rte_thread_types.h b/lib/eal/include/rte_thread_types.h index d67b24a563..7bb0d2948c 100644 --- a/lib/eal/include/rte_thread_types.h +++ b/lib/eal/include/rte_thread_types.h@@ -7,4 +7,8 @@ #include <pthread.h> +#define RTE_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER + +typedef pthread_mutex_t rte_thread_mutex_t; + #endif /* _RTE_THREAD_TYPES_H_ */diff --git a/lib/eal/windows/include/rte_windows_thread_types.h b/lib/eal/windows/include/rte_windows_thread_types.h index 60e6d94553..c6c8502bfb 100644 --- a/lib/eal/windows/include/rte_windows_thread_types.h +++ b/lib/eal/windows/include/rte_windows_thread_types.h@@ -7,4 +7,13 @@ #include <rte_windows.h> +#define WINDOWS_MUTEX_INITIALIZER (void*)-1 +#define RTE_THREAD_MUTEX_INITIALIZER {WINDOWS_MUTEX_INITIALIZER} + +struct thread_mutex_t { + void* mutex_id; +}; + +typedef struct thread_mutex_t rte_thread_mutex_t; + #endif /* _RTE_THREAD_TYPES_H_ */
In previous patches rte_thread content was made opaque and of equal size for pthread (most implementations) and non-pthread variant. AFAIU, we agree on the requirement of compatible ABI between variants, that is, a compiled app can work with any threading variant of DPDK. Above definition of `rte_thread_mutex_t` does not satisfy it. Or do we only promise API compatibility? This is the most important question now. Also: DPDK should not export names without `rte_` prefix, i. e. `WINDOWS_MUTEX_INITIALIZER` and `thread_mutex_t`. Besides, why `_t`?