-
Notifications
You must be signed in to change notification settings - Fork 202
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
Improve some pthreads stub functions, batch 1 #525
Conversation
ff07950
to
12ad798
Compare
The Open Group Base Specifications state that: * The `sched_param` _shall_ be defined, it isn't optional * Likewise, `pthread_attr_{get|set}schedparam` are not optional, but they can be implemented as stubs that only allow priority 0 * `pthread_attr_getinheritsched` *is* optional. It is part of the "TPS" Thread Execution Scheduling functionality and the Realtime Threads option group. The current stubs do not provide set, so, for consistency, get shouldn't be provided.
This is part of the "TPS" Thread Execution Scheduling functionality, and the corresponding set function is already not provided
This function isn't optional, and in any case setclock *is* provided
Although it is not supported in WASI, thread cancellation is an important feature of pthreads with wide-ranging implications. Provide the best stubs we can within the limitations by allowing cancellation type and state to be set, even though they will have no effect as pthread_cancel is stubbed to always return ENOTSUP Remove the THREAD_MODEL=single guard as it's currently not being compiled in that case, and because we intend to provide single-threaded stub implementations in the future. Incidentally replace the existing pthread_setcancelstate stub with one which actually correctly writes a value to the old parameter.
12ad798
to
3118b48
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, but lets wait for @abrown to chip in 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.
@ArcaneNibble, thanks for working on this. One thing I didn't understand: you mention that
the
pthread_atfork
stub has been dropped as it is now officially obsolete as of the very recent Issue 8 of the specifications.
Which specification? Which issue? Maybe a link would help me understand what you mean here.
Otherwise I think this makes sense. We've talked for some time about adding failing stubs to get more programs to compile and this goes down that path.
The specification I'm referring to is "The Open Group Base Specifications Issue 8, IEEE Std 1003.1-2024" The relevant page is at https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_atfork.html As stated in the "Change History" section, |
Ok, thanks for that link! And I agree with the rationale for leaving it out. |
This is the next part of breaking up #518 into smaller PRs.
This is the rest of the commits which change the existing
THREAD_MODEL=posix
functionality. It:Compared to the RFC PR, the
pthread_atfork
stub has been dropped as it is now officially obsolete as of the very recent Issue 8 of the specifications.