Skip to content

Use musl's pthread_detach #12861

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 1 commit into from
Sep 1, 2021
Merged

Use musl's pthread_detach #12861

merged 1 commit into from
Sep 1, 2021

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Nov 22, 2020

The musl version handles that case where pthread_detach is called
on a thread that is in the middle of exit'ing.

@sbc100 sbc100 force-pushed the use_native_pthread_detach branch from 6b31998 to 1916fcc Compare November 22, 2020 23:56
@sbc100 sbc100 requested a review from juj November 23, 2020 01:39
@sbc100 sbc100 force-pushed the use_native_pthread_detach branch from 1916fcc to 6a991ef Compare November 23, 2020 03:13
@@ -1,6 +1,11 @@
#include "pthread_impl.h"
#include <threads.h>

// XXX Emscripten implements pthread_exit directly rather than __pthread_exit
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment is about pthread_exit? Should it instead say about pthread_join?

@juj
Copy link
Collaborator

juj commented Nov 24, 2020

we get
a code size reduction

How big of a difference was this for code size?

This PR should definitely be run against https://github.com/juj/posixtestsuite to verify that the new implementation is still conformant, or if not, check if there is a good reason not to be. Pthread detach tests are at https://github.com/juj/posixtestsuite/tree/master/conformance/interfaces/pthread_detach

@sbc100
Copy link
Collaborator Author

sbc100 commented Nov 24, 2020

OK, I'll hold off until I can at least run the testsuite.

Surely we need to integrate that testsuite somehow? Otherwise we can't know if any of our changes are safe right? Should I open a bug to do that?

@sbc100
Copy link
Collaborator Author

sbc100 commented Nov 24, 2020

Also, assuming we can find a test that fails, but also fails in upstream musl, can we agree that that is acceptable. i.e. there is no need for us to be more conformant the musl itself? I think that same statement is mostly true for the rest of libc too.

@sbc100 sbc100 force-pushed the use_native_pthread_detach branch from 6a991ef to 6c3ade1 Compare November 24, 2020 18:08
@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 1, 2020

Adding posixtestsuite in #12923

Base automatically changed from master to main March 8, 2021 23:49
@sbc100 sbc100 force-pushed the use_native_pthread_detach branch 2 times, most recently from 7fea52b to 79214d1 Compare August 31, 2021 23:48
@sbc100 sbc100 requested a review from tlively August 31, 2021 23:49
@sbc100 sbc100 force-pushed the use_native_pthread_detach branch from 79214d1 to 4cf5eb6 Compare August 31, 2021 23:54
@sbc100 sbc100 requested a review from juj August 31, 2021 23:54
@sbc100
Copy link
Collaborator Author

sbc100 commented Aug 31, 2021

Reviving this patch. We now run posixtest suite are part of CI and I also ran it locally to confirm everything passes. I did have to patch in a couple of extra checks that musl was overlooking.

@sbc100 sbc100 force-pushed the use_native_pthread_detach branch from 4cf5eb6 to c083999 Compare August 31, 2021 23:58
Copy link
Collaborator

@juj juj left a comment

Choose a reason for hiding this comment

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

lgtm!

@sbc100 sbc100 force-pushed the use_native_pthread_detach branch 2 times, most recently from efac5d6 to 0a396d6 Compare September 1, 2021 10:42
@sbc100 sbc100 force-pushed the use_native_pthread_detach branch 3 times, most recently from 1791d74 to c1cb3c0 Compare September 1, 2021 13:11
@sbc100 sbc100 enabled auto-merge (squash) September 1, 2021 13:11
The musl version handles that case where pthread_detach is called
on a thread that is in the middle of exit'ing.
@sbc100 sbc100 force-pushed the use_native_pthread_detach branch from c1cb3c0 to 6e9e10d Compare September 1, 2021 15:46
@sbc100 sbc100 merged commit 687b8bf into main Sep 1, 2021
@sbc100 sbc100 deleted the use_native_pthread_detach branch September 1, 2021 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants