Skip to content

Commit af7d56a

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 3c235d5 commit af7d56a

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
@@ -166,8 +166,7 @@ impl Thread {
166166
unsafe {
167167
let ret = libc::pthread_join(self.id, ptr::null_mut());
168168
mem::forget(self);
169-
assert!(ret == 0,
170-
"failed to join thread: {}", io::Error::from_raw_os_error(ret));
169+
debug_assert_eq!(ret, 0);
171170
}
172171
}
173172

src/libstd/sys/windows/c.rs

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

269269
pub const WAIT_OBJECT_0: DWORD = 0x00000000;
270270
pub const WAIT_TIMEOUT: DWORD = 258;
271-
pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
272271

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

src/libstd/sys/windows/thread.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,7 @@ impl Thread {
5959
}
6060

6161
pub fn join(self) {
62-
let rc = unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE) };
63-
if rc == c::WAIT_FAILED {
64-
panic!("failed to join on thread: {}",
65-
io::Error::last_os_error());
66-
}
62+
unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE); }
6763
}
6864

6965
pub fn yield_now() {

src/libstd/thread/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,11 +1436,6 @@ impl<T> JoinHandle<T> {
14361436
/// [`panic`]: ../../std/macro.panic.html
14371437
/// [atomic memory orderings]: ../../std/sync/atomic/index.html
14381438
///
1439-
/// # Panics
1440-
///
1441-
/// This function may panic on some platforms if a thread attempts to join
1442-
/// itself or otherwise may create a deadlock with joining threads.
1443-
///
14441439
/// # Examples
14451440
///
14461441
/// ```

0 commit comments

Comments
 (0)