Skip to content

std: pass the Thread for the newly spawned thread to the platform#146678

Closed
joboet wants to merge 2 commits into
rust-lang:mainfrom
joboet:platform_thread_set_current
Closed

std: pass the Thread for the newly spawned thread to the platform#146678
joboet wants to merge 2 commits into
rust-lang:mainfrom
joboet:platform_thread_set_current

Conversation

@joboet

@joboet joboet commented Sep 17, 2025

Copy link
Copy Markdown
Member

This PR moves the responsibility for calling set_current (which initialises the thread handle) to the platform implementation. This unblocks #144465 and cleans up the fallout from #144500, as well as enabling the removal of the set_name function on platforms without thread names (as we now have access to the thread name in the platform thread main function).

This PR also contains a second commit (sorry, I couldn't help myself) that fixes a (mostly theoretical) unsoundness introduced by #115746, which added a call to current_os_id to the SIGSEGV signal handler even though that function might not be async-signal-safe. The thread ID is now initialised before the stack overflow information, so the ID can be stored therein.

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 17, 2025
@rustbot

rustbot commented Sep 17, 2025

Copy link
Copy Markdown
Collaborator

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@orlp

orlp commented Sep 21, 2025

Copy link
Copy Markdown
Contributor

This actually conflicts with #144465 due to parallel work. @joboet Can you take a look?

@bors

bors commented Sep 29, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #147090) made this pull request unmergeable. Please resolve the merge conflicts.

@joboet joboet added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 31, 2025
@joboet

joboet commented Nov 29, 2025

Copy link
Copy Markdown
Member Author

Closing in favour of #144465 (just merged) and #149456.

@joboet joboet closed this Nov 29, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix Operating system: Unix-like T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants