]> git.lizzy.rs Git - rust.git/commitdiff
Revert "std: adjust requested stack size for thread-local storage."
authorHuon Wilson <dbau.pp+github@gmail.com>
Sun, 5 Jan 2014 23:28:04 +0000 (10:28 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Sun, 5 Jan 2014 23:29:24 +0000 (10:29 +1100)
This reverts commit f1b5f59287106fc511d29c425255bd343608065c.

Using a private function of a library is a bad idea: several people (on
Linux) were meeting with linking errors because of it (different/older
versions of glibc).

src/libstd/rt/thread.rs
src/test/run-pass/large-thread-local-data.rs [deleted file]

index 536043441e71cfa5d58946dd0c6864dd82cb961e..f4f4aaa276524231e34a3efdfe95c6bc11010fa4 100644 (file)
@@ -202,10 +202,8 @@ pub unsafe fn create(stack: uint, p: ~proc()) -> rust_thread {
         let mut native: libc::pthread_t = intrinsics::uninit();
         let mut attr: libc::pthread_attr_t = intrinsics::uninit();
         assert_eq!(pthread_attr_init(&mut attr), 0);
-
-        let min_stack = get_min_stack(&attr);
         assert_eq!(pthread_attr_setstacksize(&mut attr,
-                                             min_stack + stack as libc::size_t), 0);
+                                             stack as libc::size_t), 0);
         assert_eq!(pthread_attr_setdetachstate(&mut attr,
                                                PTHREAD_CREATE_JOINABLE), 0);
 
@@ -230,18 +228,6 @@ pub unsafe fn detach(native: rust_thread) {
     #[cfg(not(target_os = "macos"), not(target_os = "android"))]
     pub unsafe fn yield_now() { assert_eq!(pthread_yield(), 0); }
 
-    // Issue #6233. On some platforms, putting a lot of data in
-    // thread-local storage means we need to set the stack-size to be
-    // larger.
-    #[cfg(target_os = "linux")]
-    unsafe fn get_min_stack(attr: &libc::pthread_attr_t) -> libc::size_t {
-        __pthread_get_minstack(attr)
-    }
-    #[cfg(not(target_os = "linux"))]
-    unsafe fn get_min_stack(_: &libc::pthread_attr_t) -> libc::size_t {
-        0
-    }
-
     extern {
         fn pthread_create(native: *mut libc::pthread_t,
                           attr: *libc::pthread_attr_t,
@@ -261,10 +247,6 @@ fn pthread_attr_setdetachstate(attr: *mut libc::pthread_attr_t,
         fn sched_yield() -> libc::c_int;
         #[cfg(not(target_os = "macos"), not(target_os = "android"))]
         fn pthread_yield() -> libc::c_int;
-
-        // This appears to be glibc specific
-        #[cfg(target_os = "linux")]
-        fn __pthread_get_minstack(attr: *libc::pthread_attr_t) -> libc::size_t;
     }
 }
 
diff --git a/src/test/run-pass/large-thread-local-data.rs b/src/test/run-pass/large-thread-local-data.rs
deleted file mode 100644 (file)
index 90b4b80..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Issue #6233
-// xfail-fast feature doesn't work
-
-#[feature(thread_local)];
-#[allow(dead_code)];
-
-static SIZE: uint = 1 << 23;
-
-#[thread_local]
-static FOO: [u8, .. SIZE] = [0, .. SIZE];
-
-fn main() {}