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
posix: implement pthread_attr_getinheritsched() and pthread_attr_setinheritsched() #68470
posix: implement pthread_attr_getinheritsched() and pthread_attr_setinheritsched() #68470
Conversation
46c840a
to
a36faff
Compare
What should I set on initial value in |
6ca5c59
to
cfbe8f4
Compare
It seems to be "implementation-defined" according to the spec:
I did a quick search on google for
The Apache NuttX however, has the default value of |
cfbe8f4
to
076916c
Compare
closed by error 😓 |
076916c
to
4abeb94
Compare
Wow @moonlight83340 - you have been very busy! Thanks - I'm taking a look now. |
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.
@moonlight83340 - nice work 👍
I think there may be some additional tests to write, and likely some additional work on the implementation of pthread_create()
Tests:
-
Verify that the scheduling attributes of the parent thread (policy, priority, ..) are inherited by a child thread when INHERIT_SCHED is used. This may be tricky, because currently Zephyr threads are not pthreads. It might be necessary to extrapolate equivalent pthread attributes (policy, priority) from the running
k_thread
and compare those. -
Verify that the scheduling attributes specified by the pthread_attr_t are passed to the child thread.
For both of those, you should be able to create a static helper function in the same file. Something like this?
static void test_pthread_attr_set_inheritsched_common(int inheritsched);
ad95b34
to
ab5db34
Compare
Still working on the test part not sure on how I will do that but I think I got it for the I have done something like that :
|
e763394
to
44679a2
Compare
Not sure on the error, I will check that when I have time. |
@moonlight83340 - can you please update this PR? |
I will take a look on the week ! ^^' |
44679a2
to
453b350
Compare
I think, I need to check on before the thread creation to found why the thread can't create another thread. |
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.
It's close - a suggestion to maybe simplify things
@moonlight83340 - can you apply this patch on top of your current commit? (please also fixup the code and test commits seperately) |
bfa882a
to
4716053
Compare
@moonlight83340 - fixup commits are somewhat special. Check this out. Also, the See also Contribution Workflow. |
I had never used fixup in git command, so thank you ! |
Should I rebase ? |
@moonlight83340 - you should also rebase on main if you haven't already. This PR is a bit behind. git checkout main
git fetch -p && git pull
git checkout getinheritsched_setinheritsched
git rebase main For reference, my rebased version of this PR shows over 500 commits and nearly 2000 files changed |
@moonlight83340 - this would be a more accurate test, I think. |
4716053
to
0d1e492
Compare
Implement `pthread_attr_setinheritsched()` and `pthread_attr_getinheritsched()`are required as part of _POSIX_THREAD_PRIORITY_SCHEDULING Option Group. signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
`pthread_attr_getinheritsched()` and `pthread_attr_setinheritsched()` are now implemented, mark it so. signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
0d1e492
to
2886142
Compare
…attr Add tests for `pthread_attr_setinheritsched()` and `pthread_attr_getinheritsched()` signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2886142
to
77bc598
Compare
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 👍
Thanks to you, I will carefully check your patch. |
This is part of the See #51211 (RFC #51211).
pthread_attr_setinheritsched()
andpthread_attr_getinheritsched()
are required as part of _POSIX_THREAD_PRIORITY_SCHEDULING Option Group.For more information, please refer to https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_attr_setinheritsched.html
Fixes #66968
Fixes #66966