Skip to content

Commit d0204dc

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 5e1a799 commit d0204dc

File tree

4 files changed

+2
-11
lines changed

4 files changed

+2
-11
lines changed

src/libstd/sys/unix/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl Thread {
183183
unsafe {
184184
let ret = libc::pthread_join(self.id, ptr::null_mut());
185185
mem::forget(self);
186-
assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret));
186+
debug_assert_eq!(ret, 0);
187187
}
188188
}
189189

src/libstd/sys/windows/c.rs

-1
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

+1-4
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ impl Thread {
6565
}
6666

6767
pub fn join(self) {
68-
let rc = unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE) };
69-
if rc == c::WAIT_FAILED {
70-
panic!("failed to join on thread: {}", io::Error::last_os_error());
71-
}
68+
unsafe { c::WaitForSingleObject(self.handle.raw(), c::INFINITE); }
7269
}
7370

7471
pub fn yield_now() {

src/libstd/thread/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1447,11 +1447,6 @@ impl<T> JoinHandle<T> {
14471447
/// [`panic`]: ../../std/macro.panic.html
14481448
/// [atomic memory orderings]: ../../std/sync/atomic/index.html
14491449
///
1450-
/// # Panics
1451-
///
1452-
/// This function may panic on some platforms if a thread attempts to join
1453-
/// itself or otherwise may create a deadlock with joining threads.
1454-
///
14551450
/// # Examples
14561451
///
14571452
/// ```

0 commit comments

Comments
 (0)