Skip to content

Commit 0a1ad74

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 625451e commit 0a1ad74

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

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
@@ -1438,11 +1438,6 @@ impl<T> JoinHandle<T> {
14381438
/// [`panic`]: ../../std/macro.panic.html
14391439
/// [atomic memory orderings]: ../../std/sync/atomic/index.html
14401440
///
1441-
/// # Panics
1442-
///
1443-
/// This function may panic on some platforms if a thread attempts to join
1444-
/// itself or otherwise may create a deadlock with joining threads.
1445-
///
14461441
/// # Examples
14471442
///
14481443
/// ```

0 commit comments

Comments
 (0)