Skip to content

Commit 353abcd

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 eae3437 commit 353abcd

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
@@ -164,8 +164,7 @@ impl Thread {
164164
unsafe {
165165
let ret = libc::pthread_join(self.id, ptr::null_mut());
166166
mem::forget(self);
167-
assert!(ret == 0,
168-
"failed to join thread: {}", io::Error::from_raw_os_error(ret));
167+
debug_assert_eq!(ret, 0);
169168
}
170169
}
171170

src/libstd/sys/windows/c.rs

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

258258
pub const WAIT_OBJECT_0: DWORD = 0x00000000;
259259
pub const WAIT_TIMEOUT: DWORD = 258;
260-
pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
261260

262261
pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
263262
pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;

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)