Rollup merge of #114696 - g0djan:godjan/fix_114610, r=Mark-Simulacrum
Fix a pthread_t handle leak #114610 https://github.com/rust-lang/rust/issues/114610 Ran the tests as described in https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasi-preview1-threads.md?plain=1#L125
This commit is contained in:
commit
128ff0897b
@ -47,12 +47,20 @@ pub fn pthread_attr_setstacksize(
|
||||
stack_size: libc::size_t,
|
||||
) -> ffi::c_int;
|
||||
pub fn pthread_attr_destroy(attr: *mut pthread_attr_t) -> ffi::c_int;
|
||||
pub fn pthread_detach(thread: pthread_t) -> ffi::c_int;
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Thread {
|
||||
id: libc::pthread_t,
|
||||
}
|
||||
|
||||
impl Drop for Thread {
|
||||
fn drop(&mut self) {
|
||||
let ret = unsafe { libc::pthread_detach(self.id) };
|
||||
debug_assert_eq!(ret, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pub struct Thread(!);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user