Skip to content

Ensure pthread key dtors run on main thread too #14512

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
Jun 23, 2021

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jun 22, 2021

No description provided.

@sbc100 sbc100 requested a review from kleisauke June 22, 2021 21:50
@sbc100 sbc100 force-pushed the main_thread_pthread_key_dtor branch 2 times, most recently from a2df17c to 4ba2f31 Compare June 22, 2021 21:54
@sbc100 sbc100 requested a review from kripken June 22, 2021 21:56
@sbc100 sbc100 force-pushed the main_thread_pthread_key_dtor branch 2 times, most recently from 81d15b8 to 048326a Compare June 22, 2021 22:30
@sbc100 sbc100 force-pushed the main_thread_pthread_key_dtor branch from 048326a to e8269a4 Compare June 23, 2021 14:21
@sbc100 sbc100 enabled auto-merge (squash) June 23, 2021 14:39
@sbc100 sbc100 disabled auto-merge June 23, 2021 15:17
@sbc100 sbc100 merged commit 6d3e78c into main Jun 23, 2021
@sbc100 sbc100 deleted the main_thread_pthread_key_dtor branch June 23, 2021 15:43
@kleisauke
Copy link
Collaborator

I just noticed that the destructor function in test_pthread_setspecific_mainthread.c is never called when testing this on Linux. According to https://stackoverflow.com/a/6357265 pthread key dtors are only run when a thread exits (or when pthread_exit is explicitly called), so not on application exit (i.e. when the main thread exits). Sorry for not catching this earlier.

I could fix this in PR #13007 with commit dce4aa0, but let me know if a separate PR is preferred rather than deferring this to the upcoming musl upgrade.

@sbc100
Copy link
Collaborator Author

sbc100 commented Jul 23, 2021

I just noticed that the destructor function in test_pthread_setspecific_mainthread.c is never called when testing this on Linux. According to https://stackoverflow.com/a/6357265 pthread key dtors are only run when a thread exits (or when pthread_exit is explicitly called), so not on application exit (i.e. when the main thread exits). Sorry for not catching this earlier.

I could fix this in PR #13007 with commit dce4aa0, but let me know if a separate PR is preferred rather than deferring this to the upcoming musl upgrade.

Thanks for noticing that! I would love to see that commit land as its own PR. In general, I'm always a fan of splitting out each and every commit/change in separate PRs.

@sbc100
Copy link
Collaborator Author

sbc100 commented Jul 23, 2021

BTW I'm really focused on getting the musl upgrade done in the next week or so... I'm hopeful :)

@kleisauke
Copy link
Collaborator

A pull request has been made for this at #14751.

BTW I'm really focused on getting the musl upgrade done in the next week or so... I'm hopeful :)

Thanks for continuing to work on the musl upgrade!

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.

2 participants