Skip to content

Commit 9bb7ba3

Browse files
committed
Haiku: Revert "std: Handle OS errors when joining threads"
This reverts commit dc7c7ba. There is an issue with threading in cargo, where thread::join fails after completing a build. This prevents building Rust on Haiku (as the build system kills itself after failure). The problem is documented at rust-on-haiku.com issue #10
1 parent 02cd183 commit 9bb7ba3

File tree

4 files changed

+2
-13
lines changed

4 files changed

+2
-13
lines changed

src/libstd/sys/unix/thread.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ impl Thread {
175175
unsafe {
176176
let ret = libc::pthread_join(self.id, ptr::null_mut());
177177
mem::forget(self);
178-
assert!(ret == 0,
179-
"failed to join thread: {}", io::Error::from_raw_os_error(ret));
178+
debug_assert_eq!(ret, 0);
180179
}
181180
}
182181

src/libstd/sys/windows/c.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ pub const FILE_END: DWORD = 2;
269269

270270
pub const WAIT_OBJECT_0: DWORD = 0x00000000;
271271
pub const WAIT_TIMEOUT: DWORD = 258;
272-
pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
273272

274273
#[cfg(target_env = "msvc")]
275274
#[cfg(feature = "backtrace")]

src/libstd/sys/windows/thread.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ impl Thread {
6666
}
6767

6868
pub fn join(self) {
69-
let rc = unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE) };
70-
if rc == c::WAIT_FAILED {
71-
panic!("failed to join on thread: {}",
72-
io::Error::last_os_error());
73-
}
69+
unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE); }
7470
}
7571

7672
pub fn yield_now() {

src/libstd/thread/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,11 +1303,6 @@ impl<T> JoinHandle<T> {
13031303
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
13041304
/// [`panic`]: ../../std/macro.panic.html
13051305
///
1306-
/// # Panics
1307-
///
1308-
/// This function may panic on some platforms if a thread attempts to join
1309-
/// itself or otherwise may create a deadlock with joining threads.
1310-
///
13111306
/// # Examples
13121307
///
13131308
/// ```

0 commit comments

Comments
 (0)