Stabilize windows_process_extensions_main_thread_handle - #160108
Stabilize windows_process_extensions_main_thread_handle#160108ChayimFriedman2 wants to merge 1 commit into
windows_process_extensions_main_thread_handle#160108Conversation
This comment has been minimized.
This comment has been minimized.
643919c to
18f6cad
Compare
This comment has been minimized.
This comment has been minimized.
18f6cad to
56ec3e7
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
Giving access to `std::os::windows::process::ChildExt::main_thread_handle()`.
56ec3e7 to
27fdd60
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
I've nominated for libs-api to start an FCP.
Rust's terminology pretty consistently uses "main thread" so I do think it's better to be consistent with that then Microsoft's docs. |
|
@rfcbot fcp merge libs-api |
|
@the8472 has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
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