From 95cdada99a02c5abea4898f46e04f7a271419dac Mon Sep 17 00:00:00 2001 From: Peter Atashian Date: Thu, 29 Oct 2015 16:54:09 -0400 Subject: AsRawHandle and IntoRawHandle for JoinHandle This allows users to get the HANDLE of a spawned thread on Windows Signed-off-by: Peter Atashian --- src/libstd/thread/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libstd/thread') diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index eaa32cdb342..aef47aa5726 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -171,6 +171,7 @@ use sys::thread as imp; use sys_common::thread_info; use sys_common::unwind; use sys_common::util; +use sys_common::{AsInner, IntoInner}; use time::Duration; //////////////////////////////////////////////////////////////////////////////// @@ -621,6 +622,14 @@ impl JoinHandle { } } +impl AsInner for JoinHandle { + fn as_inner(&self) -> &imp::Thread { self.0.native.as_ref().unwrap() } +} + +impl IntoInner for JoinHandle { + fn into_inner(self) -> imp::Thread { self.0.native.unwrap() } +} + fn _assert_sync_and_send() { fn _assert_both() {} _assert_both::>(); -- cgit 1.4.1-3-g733a5