Skip to content

Commit 2d4e76a

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 18bf6b4 commit 2d4e76a

File tree

4 files changed

+2
-11
lines changed

4 files changed

+2
-11
lines changed

library/std/src/sys/unix/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl Thread {
190190
unsafe {
191191
let ret = libc::pthread_join(self.id, ptr::null_mut());
192192
mem::forget(self);
193-
assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret));
193+
debug_assert_eq!(ret, 0);
194194
}
195195
}
196196

library/std/src/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
pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
275274
pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;

library/std/src/sys/windows/thread.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ impl Thread {
7070
}
7171

7272
pub fn join(self) {
73-
let rc = unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE) };
74-
if rc == c::WAIT_FAILED {
75-
panic!("failed to join on thread: {}", io::Error::last_os_error());
76-
}
73+
unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE); }
7774
}
7875

7976
pub fn yield_now() {

library/std/src/thread/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,11 +1423,6 @@ impl<T> JoinHandle<T> {
14231423
/// [`Err`]: crate::result::Result::Err
14241424
/// [atomic memory orderings]: crate::sync::atomic
14251425
///
1426-
/// # Panics
1427-
///
1428-
/// This function may panic on some platforms if a thread attempts to join
1429-
/// itself or otherwise may create a deadlock with joining threads.
1430-
///
14311426
/// # Examples
14321427
///
14331428
/// ```

0 commit comments

Comments
 (0)