diff options
Diffstat (limited to 'src/libstd/sys/windows/thread.rs')
| -rw-r--r-- | src/libstd/sys/windows/thread.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index 15df5d756be..a9d094375b2 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -11,14 +11,12 @@ use prelude::v1::*; use alloc::boxed::FnBox; -use cmp; use io; use libc::{self, c_void, DWORD}; use mem; use ptr; use sys::c; use sys::handle::Handle; -use sys_common::stack::RED_ZONE; use sys_common::thread::*; use time::Duration; @@ -36,11 +34,9 @@ impl Thread { // PTHREAD_STACK_MIN bytes big. Windows has no such lower limit, it's // just that below a certain threshold you can't do anything useful. // That threshold is application and architecture-specific, however. - // For now, the only requirement is that it's big enough to hold the - // red zone. Round up to the next 64 kB because that's what the NT - // kernel does, might as well make it explicit. With the current - // 20 kB red zone, that makes for a 64 kB minimum stack. - let stack_size = (cmp::max(stack, RED_ZONE) + 0xfffe) & (-0xfffe - 1); + // Round up to the next 64 kB because that's what the NT kernel does, + // might as well make it explicit. + let stack_size = (stack + 0xfffe) & (!0xfffe); let ret = c::CreateThread(ptr::null_mut(), stack_size as libc::size_t, thread_start, &*p as *const _ as *mut _, 0, ptr::null_mut()); @@ -52,7 +48,6 @@ impl Thread { Ok(Thread { handle: Handle::new(ret) }) }; - #[no_stack_check] extern "system" fn thread_start(main: *mut libc::c_void) -> DWORD { unsafe { start_thread(main); } 0 |
