-
Notifications
You must be signed in to change notification settings - Fork 7.4k
posix: Implement pthread_equal function #60416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaiiarora - Looks good, but can you please also add a second commit with tests in tests/posix/common/src/pthread.c
?
Also, can you update your commit message? Technically, pthread_equal()
was implemented, but your change converts it from a static inline function to a regular function.
Okay, I will work on it |
added required changes @cfriedt |
Please let me know if anything is missing @cfriedt. I will work on it |
tests/posix/common/src/pthread.c
Outdated
@@ -30,6 +30,7 @@ | |||
K_THREAD_STACK_ARRAY_DEFINE(stack_e, N_THR_E, STACKS); | |||
K_THREAD_STACK_ARRAY_DEFINE(stack_t, N_THR_T, STACKS); | |||
K_THREAD_STACK_ARRAY_DEFINE(stack_1, 1, 32); | |||
K_THREAD_STACK_DEFINE(stack_p, STACKS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Patch changes pthread_equal function from static inline to regular function type Fix for issue#59942 Signed-off-by: Jai Arora <[email protected]>
Adds test case for pthread_equal Adds test coverage for same and different thread id Signed-off-by: Jai Arora <[email protected]>
add pthread_equal to supported api list Signed-off-by: Jai Arora <[email protected]>
@@ -848,4 +848,9 @@ static int posix_thread_pool_init(void) | |||
return 0; | |||
} | |||
|
|||
int pthread_equal(pthread_t pt1, pthread_t pt2) | |||
{ | |||
return (pt1 == pt2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no brackets needed here, but I'm not going to stop this from going in now. If there is another review that requires another spin, please fix this too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks @jaiiarora 👍
Patch implements pthread_equal function.
Fixes #59942