From b2b50635172254777d16d0fc6112e6d5b68b63f2 Mon Sep 17 00:00:00 2001 From: Tobias Schaffner Date: Sat, 9 Sep 2017 11:09:34 +0200 Subject: Move default stack min size to thread implementations The default min stack size value is smaller on l4re and therefore this value has to be different depending on the platform. --- src/libstd/sys/redox/thread.rs | 2 ++ src/libstd/sys/unix/l4re.rs | 4 ++-- src/libstd/sys/unix/thread.rs | 5 +++++ src/libstd/sys/windows/thread.rs | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/redox/thread.rs b/src/libstd/sys/redox/thread.rs index b2c0e285f06..c4aad8d86f8 100644 --- a/src/libstd/sys/redox/thread.rs +++ b/src/libstd/sys/redox/thread.rs @@ -16,6 +16,8 @@ use sys_common::thread::start_thread; use sys::{cvt, syscall}; use time::Duration; +pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; + pub struct Thread { id: usize, } diff --git a/src/libstd/sys/unix/l4re.rs b/src/libstd/sys/unix/l4re.rs index e07c864a6cb..21218489679 100644 --- a/src/libstd/sys/unix/l4re.rs +++ b/src/libstd/sys/unix/l4re.rs @@ -104,11 +104,11 @@ pub mod net { impl AsInner for Socket { fn as_inner(&self) -> &libc::c_int { self.0.as_inner() } } - + impl FromInner for Socket { fn from_inner(fd: libc::c_int) -> Socket { Socket(FileDesc::new(fd)) } } - + impl IntoInner for Socket { fn into_inner(self) -> libc::c_int { self.0.into_raw() } } diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 60bce7924cd..6c4a3324296 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -20,6 +20,11 @@ use time::Duration; use sys_common::thread::*; +#[cfg(not(target_os = "l4re"))] +pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; +#[cfg(target_os = "l4re")] +pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024; + pub struct Thread { id: libc::pthread_t, } diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index 2cdd86e88b0..6aea9d1fb56 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -19,6 +19,8 @@ use sys::handle::Handle; use sys_common::thread::*; use time::Duration; +pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; + pub struct Thread { handle: Handle } -- cgit 1.4.1-3-g733a5