提交 514fc308 编写于 作者: B Brian Anderson 提交者: Alex Crichton

std: Remove run_in_bare_thread

上级 b05af1f6
......@@ -1137,11 +1137,11 @@ fn test_home_sched() {
fn test_schedule_home_states() {
use sleeper_list::SleeperList;
use super::{Shutdown, Scheduler, SchedHandle};
use std::unstable::run_in_bare_thread;
use std::unstable::Thread;
use std::rt::thread::Thread;
use std::sync::deque::BufferPool;
run_in_bare_thread(proc() {
Thread::start(proc() {
let sleepers = SleeperList::new();
let mut pool = BufferPool::new();
let (normal_worker, normal_stealer) = pool.deque();
......@@ -1260,7 +1260,7 @@ fn run(next: Box<GreenTask>) {
normal_thread.join();
special_thread.join();
});
}).join();
}
//#[test]
......
......@@ -472,7 +472,7 @@ fn local_loop() -> &'static mut uvio::UvIoFactory {
#[cfg(test)]
mod test {
use std::mem::transmute;
use std::unstable::run_in_bare_thread;
use std::rt::Thread;
use super::{slice_to_uv_buf, Loop};
......@@ -496,10 +496,10 @@ fn test_slice_to_uv_buf() {
#[test]
fn loop_smoke_test() {
run_in_bare_thread(proc() {
Thread::start(proc() {
let mut loop_ = Loop::new();
loop_.run();
loop_.close();
});
}).join();
}
}
......@@ -27,7 +27,7 @@
use std::rt::rtio::{ProcessConfig, IoFactory, EventLoop};
use ai = std::io::net::addrinfo;
#[cfg(test)] use std::unstable::run_in_bare_thread;
#[cfg(test)] use std::rt::Thread;
use super::{uv_error_to_io_error, Loop};
......@@ -116,7 +116,7 @@ fn has_active_io(&self) -> bool {
#[test]
fn test_callback_run_once() {
run_in_bare_thread(proc() {
Thread::start(proc() {
let mut event_loop = UvEventLoop::new();
let mut count = 0;
let count_ptr: *mut int = &mut count;
......@@ -125,7 +125,7 @@ fn test_callback_run_once() {
});
event_loop.run();
assert_eq!(count, 1);
});
}).join();
}
pub struct UvIoFactory {
......
......@@ -53,24 +53,24 @@ unsafe fn try_unsafe_borrow() -> Option<*mut Task> {
#[cfg(test)]
mod test {
use option::{None, Option};
use unstable::run_in_bare_thread;
use rt::thread::Thread;
use super::*;
use owned::Box;
use rt::task::Task;
#[test]
fn thread_local_task_smoke_test() {
run_in_bare_thread(proc() {
Thread::start(proc() {
let task = box Task::new();
Local::put(task);
let task: Box<Task> = Local::take();
cleanup_task(task);
});
}).join();
}
#[test]
fn thread_local_task_two_instances() {
run_in_bare_thread(proc() {
Thread::start(proc() {
let task = box Task::new();
Local::put(task);
let task: Box<Task> = Local::take();
......@@ -79,12 +79,12 @@ fn thread_local_task_two_instances() {
Local::put(task);
let task: Box<Task> = Local::take();
cleanup_task(task);
});
}).join();
}
#[test]
fn borrow_smoke_test() {
run_in_bare_thread(proc() {
Thread::start(proc() {
let task = box Task::new();
Local::put(task);
......@@ -93,12 +93,12 @@ fn borrow_smoke_test() {
}
let task: Box<Task> = Local::take();
cleanup_task(task);
});
}).join();
}
#[test]
fn borrow_with_return() {
run_in_bare_thread(proc() {
Thread::start(proc() {
let task = box Task::new();
Local::put(task);
......@@ -108,12 +108,12 @@ fn borrow_with_return() {
let task: Box<Task> = Local::take();
cleanup_task(task);
});
}).join();
}
#[test]
fn try_take() {
run_in_bare_thread(proc() {
Thread::start(proc() {
let task = box Task::new();
Local::put(task);
......@@ -122,7 +122,7 @@ fn try_take() {
assert!(u.is_none());
cleanup_task(t);
});
}).join();
}
fn cleanup_task(mut t: Box<Task>) {
......
......@@ -11,7 +11,6 @@
#![doc(hidden)]
use libc::uintptr_t;
use kinds::Send;
pub use core::finally;
......@@ -21,36 +20,6 @@
pub mod sync;
pub mod mutex;
/**
Start a new thread outside of the current runtime context and wait
for it to terminate.
The executing thread has no access to a task pointer and will be using
a normal large stack.
*/
pub fn run_in_bare_thread(f: proc():Send) {
use rt::thread::Thread;
Thread::start(f).join()
}
#[test]
fn test_run_in_bare_thread() {
let i = 100;
run_in_bare_thread(proc() {
assert_eq!(i, 100);
});
}
#[test]
fn test_run_in_bare_thread_exchange() {
// Does the exchange heap work without the runtime?
let i = box 100;
run_in_bare_thread(proc() {
assert!(i == box 100);
});
}
/// Dynamically inquire about whether we're running under V.
/// You should usually not use this unless your test definitely
/// can't run correctly un-altered. Valgrind is there to help
......
......@@ -11,7 +11,7 @@
extern crate libc;
use std::mem;
use std::unstable::run_in_bare_thread;
use std::rt::thread::Thread;
#[link(name = "rustrt")]
extern {
......@@ -21,10 +21,10 @@ fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t),
pub fn main() {
unsafe {
run_in_bare_thread(proc() {
Thread::start(proc() {
let i = &100;
rust_dbg_call(callback, mem::transmute(i));
});
}).join();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册