-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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: pthread: implement pthread_cleanup_push() / pop() #65700
posix: pthread: implement pthread_cleanup_push() / pop() #65700
Conversation
ade7e56
to
574bdfc
Compare
ac15e65
to
509612c
Compare
509612c
to
e53580a
Compare
Cannot reproduce build errors locally. Will rebase. |
e53580a
to
30d90e1
Compare
30d90e1
to
4a562b4
Compare
I can. I'm seeing an allocation failure in |
set |
4a562b4
to
8679d9f
Compare
It's not ever freed. It doesn't actually count as one of the I'm using a relatively old SDK version 0.16.0. Still not seeing failures (on qemu_x86 and qemu_riscv64). |
No, the problem is that there is per-thread data allocated in this call and that never gets freed, so you end up running out of the kernel pool after you allocate 1024 bytes (by default) of these things.
I'm using 0.16.4 and getting failures. Might be good to give that a whirl? |
Ah - I see it now. Yeah, that's kind of an annoyance of using I wonder if there is a way to implement Let me give this one another whirl. |
8679d9f
to
45ec140
Compare
a42c93f
to
5571919
Compare
pthread_cleanup_push() and pthread_cleanup_pop() are required by the POSIX_THREADS_BASE Option Group as detailed in Section E.1 of IEEE-1003.1-2017. The POSIX_THREADS_BASE Option Group is required for PSE51, PSE52, PSE53, and PSE54 conformance, and is otherwise mandatory for any POSIX conforming system as per Section A.2.1.3 of IEEE-1003-1.2017. In this change, we require the addition of a dedicated pthread_key_t that will not be available for applilcation usage. Rather than including that as part of CONFIG_MAX_PTHREAD_KEY_COUNT, we increase the storage by 1 in order to be least invasive from the application perspective. Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Add a test for pthread_cleanup_push() and pthread_cleanup_pop(). Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Update docs to reflect additional support of pthread_cleanup_push() and pthread_cleanup_pop(). Signed-off-by: Christopher Friedt <cfriedt@meta.com>
5571919
to
0813e0f
Compare
@keith-packard - should be ready 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.
This is looking nice and clean now.
pthread_cleanup_push()
andpthread_cleanup_pop()
are required by the POSIX_THREADS_BASE Option Group as detailed in Section E.1 of IEEE-1003.1-2017.The POSIX_THREADS_BASE Option Group is required for PSE51, PSE52, PSE53, and PSE54 conformance, and is otherwise mandatory for any POSIX conforming system as per Section A.2.1.3 of IEEE-1003-1.2017.
Fixes #59940
Fixes #59941
See also https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cleanup_pop.html