From 89a81625f4e4e0a065524e1a6c5b4d03289347ea Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Fri, 27 Jul 2018 01:08:13 +0200 Subject: [PATCH 1/2] Impl Send & Sync for JoinHandle --- src/libstd/thread/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 90f054186d1..fcb7fc87cb2 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -1276,6 +1276,9 @@ impl JoinInner { #[stable(feature = "rust1", since = "1.0.0")] pub struct JoinHandle(JoinInner); +unsafe impl Send for JoinHandle {} +unsafe impl Sync for JoinHandle {} + impl JoinHandle { /// Extracts a handle to the underlying thread. /// From 688db1df80b9754c28b79abb141e381861402fca Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Fri, 27 Jul 2018 10:08:02 +0200 Subject: [PATCH 2/2] Add stability attributes --- src/libstd/thread/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index fcb7fc87cb2..ebd9e8ba731 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -1276,7 +1276,9 @@ impl JoinInner { #[stable(feature = "rust1", since = "1.0.0")] pub struct JoinHandle(JoinInner); +#[stable(feature = "joinhandle_impl_send_sync", since = "1.29.0")] unsafe impl Send for JoinHandle {} +#[stable(feature = "joinhandle_impl_send_sync", since = "1.29.0")] unsafe impl Sync for JoinHandle {} impl JoinHandle {