On Sat, Jun 11, 2022 at 01:25:56PM +0100, Konstantin Ananyev wrote: > > >>>Add rte_thread_equal() that tests if two rte_thread_id are equal. > >>> > >>>Signed-off-by: Narcisa Vasile <navas...@microsoft.com> > >>>Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com> > >>>--- > >>> lib/eal/common/rte_thread.c | 6 ++++++ > >>> lib/eal/include/rte_thread.h | 19 +++++++++++++++++++ > >>> lib/eal/version.map | 1 + > >>> 3 files changed, 26 insertions(+) > >>> > >>>diff --git a/lib/eal/common/rte_thread.c b/lib/eal/common/rte_thread.c > >>>index 10d6652..21ed042 100644 > >>>--- a/lib/eal/common/rte_thread.c > >>>+++ b/lib/eal/common/rte_thread.c > >>>@@ -6,6 +6,12 @@ > >>> #include <rte_thread.h> > >>> int > >>>+rte_thread_equal(rte_thread_t t1, rte_thread_t t2) > >>>+{ > >>>+ return t1.opaque_id == t2.opaque_id; > >> > >>for posix systems, why not: > >>return pthread_equal(t1.opaque_id, t2.opaque_id); > > > >because it would require 2 implementations > > We already have plenty of such cases for rte_thread implementation. > Why it became a problem here? > > when this works for both > >windows and posix platforms. (less code to maintain, no functional > >difference). > > > > Well posix insists that the only safe way for applications to > directly compare two pthread_t values is to call pthread_equal(). > So I'd suggest we do what is recommended.
agreed, will provide a v2 that uses pthread_equal().