Skip to content

Commit 514fc30

Browse files
brsonalexcrichton
authored andcommitted
std: Remove run_in_bare_thread
1 parent b05af1f commit 514fc30

File tree

6 files changed

+23
-54
lines changed

6 files changed

+23
-54
lines changed

src/libgreen/sched.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,11 +1137,11 @@ mod test {
11371137
fn test_schedule_home_states() {
11381138
use sleeper_list::SleeperList;
11391139
use super::{Shutdown, Scheduler, SchedHandle};
1140-
use std::unstable::run_in_bare_thread;
1140+
use std::unstable::Thread;
11411141
use std::rt::thread::Thread;
11421142
use std::sync::deque::BufferPool;
11431143

1144-
run_in_bare_thread(proc() {
1144+
Thread::start(proc() {
11451145
let sleepers = SleeperList::new();
11461146
let mut pool = BufferPool::new();
11471147
let (normal_worker, normal_stealer) = pool.deque();
@@ -1260,7 +1260,7 @@ mod test {
12601260

12611261
normal_thread.join();
12621262
special_thread.join();
1263-
});
1263+
}).join();
12641264
}
12651265

12661266
//#[test]

src/librustuv/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ fn local_loop() -> &'static mut uvio::UvIoFactory {
472472
#[cfg(test)]
473473
mod test {
474474
use std::mem::transmute;
475-
use std::unstable::run_in_bare_thread;
475+
use std::rt::Thread;
476476

477477
use super::{slice_to_uv_buf, Loop};
478478

@@ -496,10 +496,10 @@ mod test {
496496

497497
#[test]
498498
fn loop_smoke_test() {
499-
run_in_bare_thread(proc() {
499+
Thread::start(proc() {
500500
let mut loop_ = Loop::new();
501501
loop_.run();
502502
loop_.close();
503-
});
503+
}).join();
504504
}
505505
}

src/librustuv/uvio.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use std::rt::rtio;
2727
use std::rt::rtio::{ProcessConfig, IoFactory, EventLoop};
2828
use ai = std::io::net::addrinfo;
2929

30-
#[cfg(test)] use std::unstable::run_in_bare_thread;
30+
#[cfg(test)] use std::rt::Thread;
3131

3232
use super::{uv_error_to_io_error, Loop};
3333

@@ -116,7 +116,7 @@ impl EventLoop for UvEventLoop {
116116

117117
#[test]
118118
fn test_callback_run_once() {
119-
run_in_bare_thread(proc() {
119+
Thread::start(proc() {
120120
let mut event_loop = UvEventLoop::new();
121121
let mut count = 0;
122122
let count_ptr: *mut int = &mut count;
@@ -125,7 +125,7 @@ fn test_callback_run_once() {
125125
});
126126
event_loop.run();
127127
assert_eq!(count, 1);
128-
});
128+
}).join();
129129
}
130130

131131
pub struct UvIoFactory {

src/libstd/rt/local.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,24 @@ impl Local<local_ptr::Borrowed<Task>> for Task {
5353
#[cfg(test)]
5454
mod test {
5555
use option::{None, Option};
56-
use unstable::run_in_bare_thread;
56+
use rt::thread::Thread;
5757
use super::*;
5858
use owned::Box;
5959
use rt::task::Task;
6060

6161
#[test]
6262
fn thread_local_task_smoke_test() {
63-
run_in_bare_thread(proc() {
63+
Thread::start(proc() {
6464
let task = box Task::new();
6565
Local::put(task);
6666
let task: Box<Task> = Local::take();
6767
cleanup_task(task);
68-
});
68+
}).join();
6969
}
7070

7171
#[test]
7272
fn thread_local_task_two_instances() {
73-
run_in_bare_thread(proc() {
73+
Thread::start(proc() {
7474
let task = box Task::new();
7575
Local::put(task);
7676
let task: Box<Task> = Local::take();
@@ -79,12 +79,12 @@ mod test {
7979
Local::put(task);
8080
let task: Box<Task> = Local::take();
8181
cleanup_task(task);
82-
});
82+
}).join();
8383
}
8484

8585
#[test]
8686
fn borrow_smoke_test() {
87-
run_in_bare_thread(proc() {
87+
Thread::start(proc() {
8888
let task = box Task::new();
8989
Local::put(task);
9090

@@ -93,12 +93,12 @@ mod test {
9393
}
9494
let task: Box<Task> = Local::take();
9595
cleanup_task(task);
96-
});
96+
}).join();
9797
}
9898

9999
#[test]
100100
fn borrow_with_return() {
101-
run_in_bare_thread(proc() {
101+
Thread::start(proc() {
102102
let task = box Task::new();
103103
Local::put(task);
104104

@@ -108,12 +108,12 @@ mod test {
108108

109109
let task: Box<Task> = Local::take();
110110
cleanup_task(task);
111-
});
111+
}).join();
112112
}
113113

114114
#[test]
115115
fn try_take() {
116-
run_in_bare_thread(proc() {
116+
Thread::start(proc() {
117117
let task = box Task::new();
118118
Local::put(task);
119119

@@ -122,7 +122,7 @@ mod test {
122122
assert!(u.is_none());
123123

124124
cleanup_task(t);
125-
});
125+
}).join();
126126
}
127127

128128
fn cleanup_task(mut t: Box<Task>) {

src/libstd/unstable/mod.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![doc(hidden)]
1212

1313
use libc::uintptr_t;
14-
use kinds::Send;
1514

1615
pub use core::finally;
1716

@@ -21,36 +20,6 @@ pub mod simd;
2120
pub mod sync;
2221
pub mod mutex;
2322

24-
/**
25-
26-
Start a new thread outside of the current runtime context and wait
27-
for it to terminate.
28-
29-
The executing thread has no access to a task pointer and will be using
30-
a normal large stack.
31-
*/
32-
pub fn run_in_bare_thread(f: proc():Send) {
33-
use rt::thread::Thread;
34-
Thread::start(f).join()
35-
}
36-
37-
#[test]
38-
fn test_run_in_bare_thread() {
39-
let i = 100;
40-
run_in_bare_thread(proc() {
41-
assert_eq!(i, 100);
42-
});
43-
}
44-
45-
#[test]
46-
fn test_run_in_bare_thread_exchange() {
47-
// Does the exchange heap work without the runtime?
48-
let i = box 100;
49-
run_in_bare_thread(proc() {
50-
assert!(i == box 100);
51-
});
52-
}
53-
5423
/// Dynamically inquire about whether we're running under V.
5524
/// You should usually not use this unless your test definitely
5625
/// can't run correctly un-altered. Valgrind is there to help

src/test/run-pass/foreign-call-no-runtime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
extern crate libc;
1212

1313
use std::mem;
14-
use std::unstable::run_in_bare_thread;
14+
use std::rt::thread::Thread;
1515

1616
#[link(name = "rustrt")]
1717
extern {
@@ -21,10 +21,10 @@ extern {
2121

2222
pub fn main() {
2323
unsafe {
24-
run_in_bare_thread(proc() {
24+
Thread::start(proc() {
2525
let i = &100;
2626
rust_dbg_call(callback, mem::transmute(i));
27-
});
27+
}).join();
2828
}
2929
}
3030

0 commit comments

Comments
 (0)