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