Skip to content

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

Open
@TYPEmber

Description

@TYPEmber

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-processArea: `std::process` and `std::env`O-windowsOperating system: WindowsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions