[PATCH 3/6] eal: add basic rte thread ID equal API
Konstantin Ananyev
konstantin.v.ananyev at yandex.ru
Sat Jun 11 14:25:56 CEST 2022
>>> Add rte_thread_equal() that tests if two rte_thread_id are equal.
>>>
>>> Signed-off-by: Narcisa Vasile <navasile at microsoft.com>
>>> Signed-off-by: Tyler Retzlaff <roretzla at 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.
More information about the dev
mailing list