1
Fork 0

Don't commit thread stack on Windows

This commit is contained in:
Xidorn Quan 2018-07-30 14:02:09 +10:00
parent 70cac59031
commit fc8bb9c42c
2 changed files with 4 additions and 1 deletions

View file

@ -296,6 +296,8 @@ pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
pub const FD_SETSIZE: usize = 64; pub const FD_SETSIZE: usize = 64;
pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000;
#[repr(C)] #[repr(C)]
#[cfg(not(target_pointer_width = "64"))] #[cfg(not(target_pointer_width = "64"))]
pub struct WSADATA { pub struct WSADATA {

View file

@ -42,7 +42,8 @@ impl Thread {
let stack_size = (stack + 0xfffe) & (!0xfffe); let stack_size = (stack + 0xfffe) & (!0xfffe);
let ret = c::CreateThread(ptr::null_mut(), stack_size, let ret = c::CreateThread(ptr::null_mut(), stack_size,
thread_start, &*p as *const _ as *mut _, thread_start, &*p as *const _ as *mut _,
0, ptr::null_mut()); c::STACK_SIZE_PARAM_IS_A_RESERVATION,
ptr::null_mut());
return if ret as usize == 0 { return if ret as usize == 0 {
Err(io::Error::last_os_error()) Err(io::Error::last_os_error())