Skip to content

Commit fc8bb9c

Browse files
committed
Don't commit thread stack on Windows
1 parent 70cac59 commit fc8bb9c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/libstd/sys/windows/c.rs

+2
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
296296

297297
pub const FD_SETSIZE: usize = 64;
298298

299+
pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000;
300+
299301
#[repr(C)]
300302
#[cfg(not(target_pointer_width = "64"))]
301303
pub struct WSADATA {

src/libstd/sys/windows/thread.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ impl Thread {
4242
let stack_size = (stack + 0xfffe) & (!0xfffe);
4343
let ret = c::CreateThread(ptr::null_mut(), stack_size,
4444
thread_start, &*p as *const _ as *mut _,
45-
0, ptr::null_mut());
45+
c::STACK_SIZE_PARAM_IS_A_RESERVATION,
46+
ptr::null_mut());
4647

4748
return if ret as usize == 0 {
4849
Err(io::Error::last_os_error())

0 commit comments

Comments
 (0)