Stabilize windows_process_extensions_main_thread_handle - #160108
Open
ChayimFriedman2 wants to merge 1 commit into
Open
Stabilize windows_process_extensions_main_thread_handle#160108ChayimFriedman2 wants to merge 1 commit into
windows_process_extensions_main_thread_handle#160108ChayimFriedman2 wants to merge 1 commit into
Conversation
This comment has been minimized.
This comment has been minimized.
Giving access to `std::os::windows::process::ChildExt::main_thread_handle()`.
ChayimFriedman2
force-pushed
the
stabilize-main-thread-windows
branch
from
July 28, 2026 23:45
643919c to
18f6cad
Compare
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I propose we stabilize the library feature
windows_process_extensions_main_thread_handle(tracking issue #96723).Stabilization Report
Implementation History
This feature was added in #96725, and not changed since.
API Summary
This method gives access to the handle to the main thread of a spawned child process on Windows. It is not possible to get after spawning using documented APIs, and it's useful for example for resuming a process that started as suspended (while it's possible to enumerate all threads and resume them all, that's slower and more complicated).
Experience Report
My personal reason for this is wanting to use it for this case exactly (resuming a suspended process) in rust-analyzer, see rust-lang/rust-analyzer#22763 (comment). Other people seem to want this for the same reason as well (for example in the tracking issue). Searching GitHub for
.main_thread_handle()gives 269 results. Some are for resuming processes, but there are also others - for example, injecting a DLL. I even found a project that gates using this method behind a feature, and if it's not set, uses an undocumented Windows API instead.Unresolved Questions
There are two unresolved questions:
Option<BorrowedHandle<'_>>? This will enable conversion from a handle tostd::process::Child(such conversion is not supported currently). Such conversion is not supported for any OS currently though, and making this function returningOptionwill complicate code using it, so I chose to not do that.r? libs-api