Skip to content

Wrap std::sys::windows::process::Process's main_thread_handle with Option<T>. #107144

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

Open
TYPEmber opened this issue Jan 21, 2023 · 0 comments
Open
Labels
A-process Area: `std::process` and `std::env` O-windows Operating system: Windows T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@TYPEmber
Copy link

how about make main_thread_handle as Option?

Except creating a child process, it is difficult for us to get the main_thread_handle of another process. If we make this item Option, we could extend struct Process's use case. Such as building a process manager, which holds some process's handle without main_thread_handle.

pub struct Process {
    handle: Handle,
    main_thread_handle: Option<Handle>,
}

impl Process {
    ...

    pub fn main_thread_handle(&self) -> Option<BorrowedHandle<'_>> {
        self.main_thread_handle?.as_handle()
    }

    ...
}

Maybe related to #96723

@workingjubilee workingjubilee added the O-windows Operating system: Windows label Mar 21, 2023
@workingjubilee workingjubilee added the A-process Area: `std::process` and `std::env` label Jul 22, 2023
@ChrisDenton ChrisDenton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-process Area: `std::process` and `std::env` O-windows Operating system: Windows T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants