Skip to content

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

Merged
merged 3 commits into from
Jul 20, 2023

Conversation

jaiiarora
Copy link
Contributor

@jaiiarora jaiiarora commented Jul 16, 2023

Patch implements pthread_equal function.

Fixes #59942

@jaiiarora jaiiarora requested a review from cfriedt as a code owner July 16, 2023 09:16
@zephyrbot zephyrbot added the area: POSIX POSIX API Library label Jul 16, 2023
Copy link
Member

@cfriedt cfriedt left a 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.

@jaiiarora
Copy link
Contributor Author

Okay, I will work on it

@jaiiarora
Copy link
Contributor Author

jaiiarora commented Jul 18, 2023

added required changes @cfriedt

@jaiiarora
Copy link
Contributor Author

Please let me know if anything is missing @cfriedt. I will work on it

@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed.

Copy link
Contributor Author

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]>
@zephyrbot zephyrbot added area: CMSIS API Layer CMSIS-RTOS API Layer area: Portability Standard compliant code, toolchain abstraction labels Jul 20, 2023
@zephyrbot zephyrbot requested a review from nashif July 20, 2023 10:37
@jaiiarora jaiiarora requested a review from cfriedt July 20, 2023 11:32
@@ -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);
Copy link
Member

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.

Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @jaiiarora 👍

@cfriedt cfriedt added area: Tests Issues related to a particular existing or missing test and removed area: CMSIS API Layer CMSIS-RTOS API Layer labels Jul 20, 2023
@cfriedt cfriedt requested review from keith-packard, jgl-meta and ycsin and removed request for daor-oti July 20, 2023 12:50
@carlescufi carlescufi merged commit 7daaad4 into zephyrproject-rtos:main Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Portability Standard compliant code, toolchain abstraction area: POSIX POSIX API Library area: Tests Issues related to a particular existing or missing test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

posix: implement pthread_equal()
5 participants