std: Remove run_in_bare_thread
This commit is contained in:
parent
b05af1f6a8
commit
514fc308b0
@ -1137,11 +1137,11 @@ mod test {
|
||||
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 @@ mod test {
|
||||
|
||||
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 @@ mod test {
|
||||
|
||||
#[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;
|
||||
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 @@ impl EventLoop for UvEventLoop {
|
||||
|
||||
#[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 @@ impl Local<local_ptr::Borrowed<Task>> for 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 @@ mod test {
|
||||
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 @@ mod 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 @@ mod test {
|
||||
|
||||
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 @@ mod test {
|
||||
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 simd;
|
||||
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 @@ extern {
|
||||
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
run_in_bare_thread(proc() {
|
||||
Thread::start(proc() {
|
||||
let i = &100;
|
||||
rust_dbg_call(callback, mem::transmute(i));
|
||||
});
|
||||
}).join();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user