Skip to content

Windows: support DuplicateHandle on GetCurrentThread handle (and generally fix thread handle behavior) #4830

@RalfJung

Description

@RalfJung

The tests/fail-dep/concurrency/windows_join_main.rs test currently has to do hackery to obtain a handle for the main thread that is usable from another thread. The proper way to do that is to call GetCurrentThread to get a pseudo handle, then call DuplicateHandle to turn that into a "real" handle.

What's not clear to me currently is if that handle is identical to the kind of handle that is returned when spawning a thread. Those handles have the special property that closing them detaches the thread -- it would seem odd to do that when just closing a handle one got from DuplicateHandle?

Cc @beepster4096 @CraftSpider

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-shimsArea: This affects the external function shimsA-windowsArea: affects only Windows targetsC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions