about summary refs log tree commit diff
path: root/src/libstd/sys/windows/thread.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-27 04:20:28 +0000
committerbors <bors@rust-lang.org>2017-08-27 04:20:28 +0000
commit93cdf5e3c45a0578c79afe8563065d07e5f6984f (patch)
tree89335a69e7db0057a54ade2e1365349fa26a9c0d /src/libstd/sys/windows/thread.rs
parent3e964612302e649e3c59a0b556001d801357306d (diff)
parentdc7c7ba0c9f401f5597a245e05ee9e8d760715d3 (diff)
downloadrust-93cdf5e3c45a0578c79afe8563065d07e5f6984f.tar.gz
rust-93cdf5e3c45a0578c79afe8563065d07e5f6984f.zip
Auto merge of #44112 - alexcrichton:thread-join, r=sfackler
std: Handle OS errors when joining threads

Also add to the documentation that the `join` method can panic.

cc #34971
cc #43539
Diffstat (limited to 'src/libstd/sys/windows/thread.rs')
-rw-r--r--src/libstd/sys/windows/thread.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs
index 5a376a867ee..2cdd86e88b0 100644
--- a/src/libstd/sys/windows/thread.rs
+++ b/src/libstd/sys/windows/thread.rs
@@ -61,7 +61,11 @@ impl Thread {
     }
 
     pub fn join(self) {
-        unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE); }
+        let rc = unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE) };
+        if rc == c::WAIT_FAILED {
+            panic!("failed to join on thread: {}",
+                   io::Error::last_os_error());
+        }
     }
 
     pub fn yield_now() {