std: Remove #[allow] directives in sys modules

These were suppressing lots of interesting warnings! Turns out there was also
quite a bit of dead code.
This commit is contained in:
Alex Crichton 2015-03-09 20:04:35 -07:00
parent 206ee0e853
commit c933d44f7b
35 changed files with 86 additions and 176 deletions

View File

@ -273,13 +273,14 @@
pub mod thread;
pub mod sync;
#[macro_use]
#[path = "sys/common/mod.rs"] mod sys_common;
#[cfg(unix)]
#[path = "sys/unix/mod.rs"] mod sys;
#[cfg(windows)]
#[path = "sys/windows/mod.rs"] mod sys;
#[path = "sys/common/mod.rs"] mod sys_common;
pub mod rt;
mod panicking;

View File

@ -108,9 +108,7 @@ fn lang_start(main: *const u8, argc: int, argv: *const *const u8) -> int {
// but we just do this to name the main thread and to give it correct
// info about the stack bounds.
let thread: Thread = NewThread::new(Some("<main>".to_string()));
thread_info::set((my_stack_bottom, my_stack_top),
sys::thread::guard::main(),
thread);
thread_info::set(sys::thread::guard::main(), thread);
// By default, some platforms will send a *signal* when a EPIPE error
// would otherwise be delivered. This runtime doesn't install a SIGPIPE

View File

@ -70,6 +70,17 @@ unsafe impl<M:Send> Sync for Helper<M> { }
unsafe impl Send for RaceBox {}
unsafe impl Sync for RaceBox {}
macro_rules! helper_init { (static $name:ident: Helper<$m:ty>) => (
static $name: Helper<$m> = Helper {
lock: ::sync::MUTEX_INIT,
cond: ::sync::CONDVAR_INIT,
chan: ::cell::UnsafeCell { value: 0 as *mut Sender<$m> },
signal: ::cell::UnsafeCell { value: 0 },
initialized: ::cell::UnsafeCell { value: false },
shutdown: ::cell::UnsafeCell { value: false },
};
) }
impl<M: Send> Helper<M> {
/// Lazily boots a helper thread, becoming a no-op if the helper has already
/// been spawned.

View File

@ -9,7 +9,6 @@
// except according to those terms.
#![allow(missing_docs)]
#![allow(dead_code)]
use old_io::{self, IoError, IoResult};
use prelude::v1::*;
@ -19,9 +18,10 @@
use old_path::BytesContainer;
use collections;
#[macro_use] pub mod helper_thread;
pub mod backtrace;
pub mod condvar;
pub mod helper_thread;
pub mod mutex;
pub mod net;
pub mod net2;

View File

@ -26,7 +26,9 @@
use sys::{self, retry, c, sock_t, last_error, last_net_error, last_gai_error, close_sock,
wrlen, msglen_t, os, wouldblock, set_nonblocking, timer, ms_to_timeval,
decode_error_detailed};
use sync::{Arc, Mutex, MutexGuard};
use sync::{Arc, Mutex};
#[cfg(not(target_os = "linux"))]
use sync::MutexGuard;
use sys_common::{self, keep_going, short_write, timeout};
use cmp;
use old_io;
@ -620,11 +622,13 @@ impl Drop for Inner {
fn drop(&mut self) { unsafe { close_sock(self.fd); } }
}
#[cfg(not(target_os = "linux"))]
pub struct Guard<'a> {
pub fd: sock_t,
pub guard: MutexGuard<'a, ()>,
}
#[cfg(not(target_os = "linux"))]
#[unsafe_destructor]
impl<'a> Drop for Guard<'a> {
fn drop(&mut self) {

View File

@ -15,7 +15,6 @@
use libc::{self, c_int, c_char, c_void, socklen_t};
use mem;
use net::{IpAddr, SocketAddr, Shutdown};
use num::Int;
use sys::c;
use sys::net::{cvt, cvt_r, cvt_gai, Socket, init, wrlen_t};
use sys_common::{AsInner, FromInner, IntoInner};
@ -24,9 +23,6 @@
// sockaddr and misc bindings
////////////////////////////////////////////////////////////////////////////////
fn hton<I: Int>(i: I) -> I { i.to_be() }
fn ntoh<I: Int>(i: I) -> I { Int::from_be(i) }
fn setsockopt<T>(sock: &Socket, opt: c_int, val: c_int,
payload: T) -> io::Result<()> {
unsafe {
@ -39,7 +35,7 @@ fn setsockopt<T>(sock: &Socket, opt: c_int, val: c_int,
#[allow(dead_code)]
fn getsockopt<T: Copy>(sock: &Socket, opt: c_int,
val: c_int) -> io::Result<T> {
val: c_int) -> io::Result<T> {
unsafe {
let mut slot: T = mem::zeroed();
let mut len = mem::size_of::<T>() as socklen_t;

View File

@ -121,37 +121,6 @@ pub unsafe fn record_os_managed_stack_bounds(stack_lo: uint, _stack_hi: uint) {
record_sp_limit(stack_lo + RED_ZONE);
}
#[inline(always)]
pub unsafe fn record_rust_managed_stack_bounds(stack_lo: uint, stack_hi: uint) {
// When the old runtime had segmented stacks, it used a calculation that was
// "limit + RED_ZONE + FUDGE". The red zone was for things like dynamic
// symbol resolution, llvm function calls, etc. In theory this red zone
// value is 0, but it matters far less when we have gigantic stacks because
// we don't need to be so exact about our stack budget. The "fudge factor"
// was because LLVM doesn't emit a stack check for functions < 256 bytes in
// size. Again though, we have giant stacks, so we round all these
// calculations up to the nice round number of 20k.
record_sp_limit(stack_lo + RED_ZONE);
return target_record_stack_bounds(stack_lo, stack_hi);
#[cfg(not(windows))] #[inline(always)]
unsafe fn target_record_stack_bounds(_stack_lo: uint, _stack_hi: uint) {}
#[cfg(all(windows, target_arch = "x86"))] #[inline(always)]
unsafe fn target_record_stack_bounds(stack_lo: uint, stack_hi: uint) {
// stack range is at TIB: %fs:0x04 (top) and %fs:0x08 (bottom)
asm!("mov $0, %fs:0x04" :: "r"(stack_hi) :: "volatile");
asm!("mov $0, %fs:0x08" :: "r"(stack_lo) :: "volatile");
}
#[cfg(all(windows, target_arch = "x86_64"))] #[inline(always)]
unsafe fn target_record_stack_bounds(stack_lo: uint, stack_hi: uint) {
// stack range is at TIB: %gs:0x08 (top) and %gs:0x10 (bottom)
asm!("mov $0, %gs:0x08" :: "r"(stack_hi) :: "volatile");
asm!("mov $0, %gs:0x10" :: "r"(stack_lo) :: "volatile");
}
}
/// Records the current limit of the stack as specified by `end`.
///
/// This is stored in an OS-dependent location, likely inside of the thread

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code)] // stack_guard isn't used right now on all platforms
use core::prelude::*;
use cell::RefCell;
@ -16,10 +18,6 @@
use thread_local::State;
struct ThreadInfo {
// This field holds the known bounds of the stack in (lo, hi)
// form. Not all threads necessarily know their precise bounds,
// hence this is optional.
stack_bounds: (uint, uint),
stack_guard: uint,
thread: Thread,
}
@ -36,7 +34,6 @@ fn with<R, F>(f: F) -> R where F: FnOnce(&mut ThreadInfo) -> R {
THREAD_INFO.with(move |c| {
if c.borrow().is_none() {
*c.borrow_mut() = Some(ThreadInfo {
stack_bounds: (0, 0),
stack_guard: 0,
thread: NewThread::new(None),
})
@ -54,10 +51,9 @@ pub fn stack_guard() -> uint {
ThreadInfo::with(|info| info.stack_guard)
}
pub fn set(stack_bounds: (uint, uint), stack_guard: uint, thread: Thread) {
pub fn set(stack_guard: uint, thread: Thread) {
THREAD_INFO.with(|c| assert!(c.borrow().is_none()));
THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{
stack_bounds: stack_bounds,
stack_guard: stack_guard,
thread: thread,
}));

View File

@ -56,6 +56,7 @@
#![allow(non_camel_case_types)]
#![unstable(feature = "thread_local_internals")]
#![allow(dead_code)] // sys isn't exported yet
use prelude::v1::*;

View File

@ -21,6 +21,10 @@
//! nor can it decode WTF-8 from arbitrary bytes.
//! WTF-8 strings can be obtained from UTF-8, UTF-16, or code points.
// this module is imported from @SimonSapin's repo and has tons of dead code on
// unix (it's mostly used on windows), so don't worry about dead code here.
#![allow(dead_code)]
use core::prelude::*;
use core::char::{encode_utf8_raw, encode_utf16_raw};

View File

@ -84,9 +84,8 @@
/// all unix platforms we support right now, so it at least gets the job done.
use prelude::v1::*;
use os::unix::prelude::*;
use ffi::{CStr, AsOsStr};
use ffi::CStr;
use old_io::IoResult;
use libc;
use mem;
@ -151,7 +150,7 @@ struct Context<'a> {
// I/O done here is blocking I/O, not green I/O, so we don't have to
// worry about this being a native vs green mutex.
static LOCK: StaticMutex = MUTEX_INIT;
let _g = unsafe { LOCK.lock() };
let _g = LOCK.lock();
try!(writeln!(w, "stack backtrace:"));
@ -253,6 +252,8 @@ fn dladdr(addr: *const libc::c_void,
fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void,
symaddr: *mut libc::c_void) -> IoResult<()> {
use env;
use ffi::AsOsStr;
use os::unix::prelude::*;
use ptr;
////////////////////////////////////////////////////////////////////////

View File

@ -9,7 +9,6 @@
// except according to those terms.
use core::prelude::*;
use io::prelude::*;
use io;
use libc::{self, c_int, size_t, c_void};

View File

@ -13,8 +13,8 @@
use os::unix::prelude::*;
use ffi::{CString, CStr, OsString, AsOsStr, OsStr};
use io::{self, Error, Seek, SeekFrom};
use libc::{self, c_int, c_void, size_t, off_t, c_char, mode_t};
use io::{self, Error, SeekFrom};
use libc::{self, c_int, size_t, off_t, c_char, mode_t};
use mem;
use path::{Path, PathBuf};
use ptr;
@ -324,14 +324,6 @@ pub fn rmdir(p: &Path) -> io::Result<()> {
Ok(())
}
pub fn chown(p: &Path, uid: isize, gid: isize) -> io::Result<()> {
let p = try!(cstr(p));
try!(cvt_r(|| unsafe {
libc::chown(p.as_ptr(), uid as libc::uid_t, gid as libc::gid_t)
}));
Ok(())
}
pub fn readlink(p: &Path) -> io::Result<PathBuf> {
let c_path = try!(cstr(p));
let p = c_path.as_ptr();

View File

@ -10,10 +10,6 @@
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
#![allow(dead_code)]
#![allow(unused_unsafe)]
#![allow(unused_mut)]
use prelude::v1::*;
@ -21,22 +17,10 @@
use io::{self, ErrorKind};
use libc;
use num::{Int, SignedInt};
use num;
use old_io::{self, IoResult, IoError};
use old_io::{self, IoError};
use str;
use sys_common::mkerr_libc;
macro_rules! helper_init { (static $name:ident: Helper<$m:ty>) => (
static $name: Helper<$m> = Helper {
lock: ::sync::MUTEX_INIT,
cond: ::sync::CONDVAR_INIT,
chan: ::cell::UnsafeCell { value: 0 as *mut Sender<$m> },
signal: ::cell::UnsafeCell { value: 0 },
initialized: ::cell::UnsafeCell { value: false },
shutdown: ::cell::UnsafeCell { value: false },
};
) }
pub mod backtrace;
pub mod c;
pub mod condvar;

View File

@ -12,7 +12,6 @@
use cell::UnsafeCell;
use sys::sync as ffi;
use sys_common::mutex;
pub struct Mutex { inner: UnsafeCell<ffi::pthread_mutex_t> }
@ -28,6 +27,7 @@ pub unsafe fn raw(m: &Mutex) -> *mut ffi::pthread_mutex_t {
unsafe impl Send for Mutex {}
unsafe impl Sync for Mutex {}
#[allow(dead_code)] // sys isn't exported yet
impl Mutex {
#[inline]
pub unsafe fn new() -> Mutex {

View File

@ -10,6 +10,8 @@
//! Implementation of `std::os` functionality for unix systems
#![allow(unused_imports)] // lots of cfg code here
use prelude::v1::*;
use os::unix::*;
@ -482,7 +484,7 @@ unsafe fn fallback() -> Option<OsString> { None }
#[cfg(not(any(target_os = "android",
target_os = "ios")))]
unsafe fn fallback() -> Option<OsString> {
let mut amt = match libc::sysconf(c::_SC_GETPW_R_SIZE_MAX) {
let amt = match libc::sysconf(c::_SC_GETPW_R_SIZE_MAX) {
n if n < 0 => 512 as usize,
n => n as usize,
};

View File

@ -70,7 +70,7 @@ fn from_u8_slice(s: &[u8]) -> &Slice {
}
pub fn from_str(s: &str) -> &Slice {
unsafe { mem::transmute(s.as_bytes()) }
Slice::from_u8_slice(s.as_bytes())
}
pub fn to_str(&self) -> Option<&str> {

View File

@ -143,7 +143,7 @@ fn lock_nonblocking(&self) {}
fn lock_nonblocking<'a>(&'a self) -> Guard<'a> {
let ret = Guard {
fd: self.fd(),
guard: unsafe { self.inner.lock.lock().unwrap() },
guard: self.inner.lock.lock().unwrap(),
};
set_nonblocking(self.fd(), true);
ret

View File

@ -17,7 +17,7 @@
use ffi::CString;
use hash::Hash;
use old_io::process::{ProcessExit, ExitStatus, ExitSignal};
use old_io::{self, IoResult, IoError, EndOfFile};
use old_io::{IoResult, EndOfFile};
use libc::{self, pid_t, c_void, c_int};
use mem;
use os;
@ -33,12 +33,6 @@
helper_init! { static HELPER: Helper<Req> }
/// Unix-specific extensions to the Command builder
pub struct CommandExt {
uid: Option<u32>,
gid: Option<u32>,
}
/// The unique id of the process (this should never be negative).
pub struct Process {
pub pid: pid_t
@ -332,7 +326,7 @@ pub fn wait(&self, deadline: u64) -> IoResult<ProcessExit> {
// The actual communication between the helper thread and this thread is
// quite simple, just a channel moving data around.
unsafe { HELPER.boot(register_sigchld, waitpid_helper) }
HELPER.boot(register_sigchld, waitpid_helper);
match self.try_wait() {
Some(ret) => return Ok(ret),
@ -340,7 +334,7 @@ pub fn wait(&self, deadline: u64) -> IoResult<ProcessExit> {
}
let (tx, rx) = channel();
unsafe { HELPER.send(NewChild(self.pid, tx, deadline)); }
HELPER.send(NewChild(self.pid, tx, deadline));
return match rx.recv() {
Ok(e) => Ok(e),
Err(..) => Err(timeout("wait timed out")),
@ -424,8 +418,15 @@ fn waitpid_helper(input: libc::c_int,
Ok(NewChild(pid, tx, deadline)) => {
active.push((pid, tx, deadline));
}
// Once we've been disconnected it means the main
// thread is exiting (at_exit has run). We could
// still have active waiter for other threads, so
// we're just going to drop them all on the floor.
// This means that they won't receive a "you're
// done" message in which case they'll be considered
// as timed out, but more generally errors will
// start propagating.
Err(TryRecvError::Disconnected) => {
assert!(active.len() == 0);
break 'outer;
}
Err(TryRecvError::Empty) => break,

View File

@ -14,18 +14,13 @@
use env;
use ffi::{OsString, OsStr, CString};
use fmt;
use hash::Hash;
use io::{self, Error, ErrorKind};
use libc::{self, pid_t, c_void, c_int, gid_t, uid_t};
use mem;
use old_io;
use os;
use os::unix::OsStrExt;
use ptr;
use sync::mpsc::{channel, Sender, Receiver};
use sys::pipe2::AnonPipe;
use sys::{self, retry, c, wouldblock, set_nonblocking, ms_to_timeval, cvt};
use sys_common::AsInner;
use sys::{self, retry, c, cvt};
////////////////////////////////////////////////////////////////////////////////
// Command
@ -127,10 +122,6 @@ pub struct Process {
const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
impl Process {
pub fn id(&self) -> pid_t {
self.pid
}
pub unsafe fn kill(&self) -> io::Result<()> {
try!(cvt(libc::funcs::posix88::signal::kill(self.pid, libc::SIGKILL)));
Ok(())

View File

@ -23,12 +23,6 @@ unsafe impl Send for RWLock {}
unsafe impl Sync for RWLock {}
impl RWLock {
#[inline]
pub unsafe fn new() -> RWLock {
// Might be moved and address is changing it is better to avoid
// initialization of potentially opaque OS data before it landed
RWLOCK_INIT
}
#[inline]
pub unsafe fn read(&self) {
let r = ffi::pthread_rwlock_rdlock(self.inner.get());

View File

@ -37,7 +37,6 @@ fn drop(&mut self) {
target_os = "bitrig",
target_os = "openbsd"))]
mod imp {
use core::prelude::*;
use sys_common::stack;
use super::Handler;

View File

@ -139,10 +139,6 @@ pub fn accept(&mut self) -> IoResult<TcpStream> {
Err(sys_common::eof())
}
pub fn socket_name(&mut self) -> IoResult<ip::SocketAddr> {
net::sockname(self.fd(), libc::getsockname)
}
pub fn set_timeout(&mut self, timeout: Option<u64>) {
self.deadline = timeout.map(|a| sys::timer::now() + a).unwrap_or(0);
}

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code)]
use core::prelude::*;
use io;
@ -262,15 +264,15 @@ pub unsafe fn set_name(name: &str) {
// pthread_setname_np() since glibc 2.12
// availability autodetected via weak linkage
let cname = CString::new(name).unwrap();
type F = unsafe extern "C" fn(libc::pthread_t, *const libc::c_char) -> libc::c_int;
type F = unsafe extern "C" fn(libc::pthread_t, *const libc::c_char)
-> libc::c_int;
extern {
#[linkage = "extern_weak"]
static pthread_setname_np: *const ();
}
if !pthread_setname_np.is_null() {
unsafe {
mem::transmute::<*const (), F>(pthread_setname_np)(pthread_self(), cname.as_ptr());
}
mem::transmute::<*const (), F>(pthread_setname_np)(pthread_self(),
cname.as_ptr());
}
}
@ -300,6 +302,7 @@ pub unsafe fn detach(native: rust_thread) {
}
pub unsafe fn yield_now() { assert_eq!(sched_yield(), 0); }
// glibc >= 2.15 has a __pthread_get_minstack() function that returns
// PTHREAD_STACK_MIN plus however many bytes are needed for thread-local
// storage. We need that information to avoid blowing up when a small stack

View File

@ -58,11 +58,9 @@ impl<'a> Sub for &'a SteadyTime {
type Output = Duration;
fn sub(self, other: &SteadyTime) -> Duration {
unsafe {
let info = info();
let diff = self.t as i64 - other.t as i64;
Duration::nanoseconds(diff * info.numer as i64 / info.denom as i64)
}
let info = info();
let diff = self.t as i64 - other.t as i64;
Duration::nanoseconds(diff * info.numer as i64 / info.denom as i64)
}
}
}

View File

@ -100,7 +100,7 @@ pub fn now() -> u64 {
fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) {
let mut set: c::fd_set = unsafe { mem::zeroed() };
let mut fd = FileDesc::new(input, true);
let fd = FileDesc::new(input, true);
let mut timeout: libc::timeval = unsafe { mem::zeroed() };
// active timers are those which are able to be selected upon (and it's a

View File

@ -11,7 +11,7 @@
use prelude::v1::*;
use sys::fs::FileDesc;
use libc::{self, c_int, c_ulong, funcs};
use libc::{self, c_int, c_ulong};
use old_io::{self, IoResult, IoError};
use sys::c;
use sys_common;
@ -86,6 +86,4 @@ struct winsize {
pub fn get_winsize(&mut self) -> IoResult<(int, int)> {
Err(sys_common::unimpl())
}
pub fn isatty(&self) -> bool { false }
}

View File

@ -24,19 +24,16 @@
#![allow(dead_code)]
use prelude::v1::*;
use dynamic_lib::DynamicLibrary;
use ffi::CStr;
use intrinsics;
use old_io::{IoResult, Writer};
use old_io::IoResult;
use libc;
use mem;
use ops::Drop;
use option::Option::{Some};
use old_path::Path;
use ptr;
use result::Result::{Ok, Err};
use slice::SliceExt;
use str::{self, StrExt};
use str;
use sync::{StaticMutex, MUTEX_INIT};
use sys_common::backtrace::*;

View File

@ -18,7 +18,7 @@
use prelude::v1::*;
use sys;
use sys_common::{mkerr_libc};
use sys_common::{self, mkerr_libc};
use old_io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode};
use old_io::{IoResult, IoError, FileStat, SeekStyle};
@ -434,7 +434,7 @@ pub fn stat(p: &Path) -> IoResult<FileStat> {
// FIXME: move this to platform-specific modules (for now)?
pub fn lstat(_p: &Path) -> IoResult<FileStat> {
// FIXME: implementation is missing
Err(super::unimpl())
Err(sys_common::unimpl())
}
pub fn utime(p: &Path, atime: u64, mtime: u64) -> IoResult<()> {

View File

@ -24,17 +24,6 @@
use path::PathBuf;
use sync::{Once, ONCE_INIT};
macro_rules! helper_init { (static $name:ident: Helper<$m:ty>) => (
static $name: Helper<$m> = Helper {
lock: ::sync::MUTEX_INIT,
cond: ::sync::CONDVAR_INIT,
chan: ::cell::UnsafeCell { value: 0 as *mut ::sync::mpsc::Sender<$m> },
signal: ::cell::UnsafeCell { value: 0 },
initialized: ::cell::UnsafeCell { value: false },
shutdown: ::cell::UnsafeCell { value: false },
};
) }
pub mod backtrace;
pub mod c;
pub mod condvar;
@ -216,15 +205,7 @@ pub fn init_net() {
}
}
pub fn unimpl() -> IoError {
IoError {
kind: old_io::IoUnavailable,
desc: "operation is not implemented",
detail: None,
}
}
fn to_utf16(s: Option<&str>) -> IoResult<Vec<u16>> {
pub fn to_utf16(s: Option<&str>) -> IoResult<Vec<u16>> {
match s {
Some(s) => Ok(to_utf16_os(OsStr::from_str(s))),
None => Err(IoError {

View File

@ -29,7 +29,6 @@
use str;
use sync::{StaticMutex, MUTEX_INIT};
use sys::fs::FileDesc;
use sys::timer;
use sys_common::{AsInner, timeout};
@ -129,8 +128,6 @@ pub fn spawn<K, V, C, P>(cfg: &C, in_fd: Option<P>,
use libc::funcs::extra::msvcrt::get_osfhandle;
use mem;
use iter::IteratorExt;
use str::StrExt;
if cfg.gid().is_some() || cfg.uid().is_some() {
return Err(IoError {

View File

@ -10,12 +10,13 @@
#![allow(deprecated)]
use prelude::v1::*;
use old_io::net::ip;
use old_io::IoResult;
use libc;
use mem;
use ptr;
use prelude::v1::*;
use super::{last_error, last_net_error, sock_t};
use sync::Arc;
use sync::atomic::{AtomicBool, Ordering};

View File

@ -20,15 +20,15 @@
//! Other than that, the implementation is pretty straightforward in terms of
//! the other two implementations of timers with nothing *that* new showing up.
use self::Req::*;
use prelude::v1::*;
use self::Req::*;
use libc;
use ptr;
use old_io::IoResult;
use sync::mpsc::{channel, Sender, Receiver, TryRecvError};
use sys_common::helper_thread::Helper;
use sync::mpsc::{channel, TryRecvError, Sender, Receiver};
helper_init! { static HELPER: Helper<Req> }

View File

@ -38,7 +38,7 @@
use super::c::{ENABLE_ECHO_INPUT, ENABLE_EXTENDED_FLAGS};
use super::c::{ENABLE_INSERT_MODE, ENABLE_LINE_INPUT};
use super::c::{ENABLE_PROCESSED_INPUT, ENABLE_QUICK_EDIT_MODE};
use super::c::{CONSOLE_SCREEN_BUFFER_INFO};
use super::c::CONSOLE_SCREEN_BUFFER_INFO;
use super::c::{ReadConsoleW, WriteConsoleW, GetConsoleMode, SetConsoleMode};
use super::c::{GetConsoleScreenBufferInfo};

View File

@ -281,17 +281,13 @@ fn spawn_inner<T: Send>(self, f: Thunk<(), T>) -> io::Result<JoinInner<T>> {
let my_stack_top = addr as usize;
let my_stack_bottom = my_stack_top - stack_size + 1024;
unsafe {
stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top);
if let Some(name) = their_thread.name() {
imp::set_name(name);
}
stack::record_os_managed_stack_bounds(my_stack_bottom,
my_stack_top);
thread_info::set(imp::guard::current(), their_thread);
}
match their_thread.name() {
Some(name) => unsafe { imp::set_name(name); },
None => {}
}
thread_info::set(
(my_stack_bottom, my_stack_top),
unsafe { imp::guard::current() },
their_thread
);
let mut output = None;
let f: Thunk<(), T> = if stdout.is_some() || stderr.is_some() {