diff options
| author | Brian Anderson <banderson@mozilla.com> | 2014-05-14 01:13:29 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-15 13:50:50 -0700 |
| commit | 514fc308b0bcf903260f1e40fd0b18ba91539d35 (patch) | |
| tree | af1538aa2301ba968f5f8688101b3e60f53596e5 /src/libstd | |
| parent | b05af1f6a83ad6eacc02493f71fb4116b120837e (diff) | |
| download | rust-514fc308b0bcf903260f1e40fd0b18ba91539d35.tar.gz rust-514fc308b0bcf903260f1e40fd0b18ba91539d35.zip | |
std: Remove run_in_bare_thread
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/rt/local.rs | 22 | ||||
| -rw-r--r-- | src/libstd/unstable/mod.rs | 31 |
2 files changed, 11 insertions, 42 deletions
diff --git a/src/libstd/rt/local.rs b/src/libstd/rt/local.rs index 05d1f1764b5..9f0ed804480 100644 --- a/src/libstd/rt/local.rs +++ b/src/libstd/rt/local.rs @@ -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>) { diff --git a/src/libstd/unstable/mod.rs b/src/libstd/unstable/mod.rs index 8b07850263f..f464f70772d 100644 --- a/src/libstd/unstable/mod.rs +++ b/src/libstd/unstable/mod.rs @@ -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 |
