Skip to content

Ensure pthread key dtors run on main thread too - #14512

Merged
sbc100 merged 1 commit into
mainfrom
main_thread_pthread_key_dtor
Jun 23, 2021
Merged

sbc100 merged 1 commit into
mainfrom
main_thread_pthread_key_dtor

Conversation

@sbc100

@sbc100 sbc100 commented Jun 22, 2021

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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

sbc100 commented Jul 23, 2021

Copy link
Copy Markdown
Collaborator Author

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

sbc100 commented Jul 23, 2021

Copy link
Copy Markdown
Collaborator Author

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

@kleisauke

Copy link
Copy Markdown
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