Skip to content

Commit 1bce984

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 9fda7c2 commit 1bce984

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
@@ -176,8 +176,7 @@ impl Thread {
176176
unsafe {
177177
let ret = libc::pthread_join(self.id, ptr::null_mut());
178178
mem::forget(self);
179-
assert!(ret == 0,
180-
"failed to join thread: {}", io::Error::from_raw_os_error(ret));
179+
debug_assert_eq!(ret, 0);
181180
}
182181
}
183182

src/libstd/sys/windows/c.rs

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

275275
pub const WAIT_OBJECT_0: DWORD = 0x00000000;
276276
pub const WAIT_TIMEOUT: DWORD = 258;
277-
pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
278277

279278
#[cfg(target_env = "msvc")]
280279
#[cfg(feature = "backtrace")]

src/libstd/sys/windows/thread.rs

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

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

7773
pub fn yield_now() {

src/libstd/thread/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,11 +1409,6 @@ impl<T> JoinHandle<T> {
14091409
/// [`panic`]: ../../std/macro.panic.html
14101410
/// [atomic memory orderings]: ../../std/sync/atomic/index.html
14111411
///
1412-
/// # Panics
1413-
///
1414-
/// This function may panic on some platforms if a thread attempts to join
1415-
/// itself or otherwise may create a deadlock with joining threads.
1416-
///
14171412
/// # Examples
14181413
///
14191414
/// ```

0 commit comments

Comments
 (0)