Skip to content

Commit 14a0eb3

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 73528e3 commit 14a0eb3

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

src/libstd/sys/windows/c.rs

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

255255
pub const WAIT_OBJECT_0: DWORD = 0x00000000;
256256
pub const WAIT_TIMEOUT: DWORD = 258;
257-
pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
258257

259258
pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
260259
pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;

src/libstd/sys/windows/thread.rs

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

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

6864
pub fn yield_now() {

src/libstd/thread/mod.rs

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

0 commit comments

Comments
 (0)