Skip to content

Commit 8fe8cdc

Browse files
committed
---
yaml --- r: 37579 b: refs/heads/try c: 9b6f025 h: refs/heads/master i: 37577: 5b19aad 37575: 92bd77f v: v3
1 parent 86602b6 commit 8fe8cdc

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: a0610c952f0d23927443b901241627ae910fd3cd
5+
refs/heads/try: 9b6f025eb607aab8ea29c2033dcebe1d263ba614
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/libstd/std.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub mod sync;
5454
pub mod arc;
5555
pub mod comm;
5656
pub mod future;
57-
pub mod thread_pool;
57+
pub mod task_pool;
5858

5959
// Collections
6060

branches/try/src/libstd/thread_pool.rs renamed to branches/try/src/libstd/task_pool.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// A thread pool abstraction. Useful for achieving predictable CPU
1+
/// A task pool abstraction. Useful for achieving predictable CPU
22
/// parallelism.
33
44
use pipes::{Chan, Port};
@@ -9,7 +9,7 @@ enum Msg<T> {
99
Quit
1010
}
1111

12-
pub struct ThreadPool<T> {
12+
pub struct TaskPool<T> {
1313
channels: ~[Chan<Msg<T>>],
1414
mut next_index: uint,
1515

@@ -20,15 +20,15 @@ pub struct ThreadPool<T> {
2020
}
2121
}
2222

23-
pub impl<T> ThreadPool<T> {
24-
/// Spawns a new thread pool with `n_tasks` tasks. If the `sched_mode`
23+
pub impl<T> TaskPool<T> {
24+
/// Spawns a new task pool with `n_tasks` tasks. If the `sched_mode`
2525
/// is None, the tasks run on this scheduler; otherwise, they run on a
2626
/// new scheduler with the given mode. The provided `init_fn_factory`
2727
/// returns a function which, given the index of the task, should return
2828
/// local data to be kept around in that task.
2929
static fn new(n_tasks: uint,
3030
opt_sched_mode: Option<SchedMode>,
31-
init_fn_factory: ~fn() -> ~fn(uint) -> T) -> ThreadPool<T> {
31+
init_fn_factory: ~fn() -> ~fn(uint) -> T) -> TaskPool<T> {
3232
assert n_tasks >= 1;
3333

3434
let channels = do vec::from_fn(n_tasks) |i| {
@@ -59,10 +59,10 @@ pub impl<T> ThreadPool<T> {
5959
move chan
6060
};
6161

62-
return ThreadPool { channels: move channels, next_index: 0 };
62+
return TaskPool { channels: move channels, next_index: 0 };
6363
}
6464

65-
/// Executes the function `f` on a thread in the pool. The function
65+
/// Executes the function `f` on a task in the pool. The function
6666
/// receives a reference to the local data returned by the `init_fn`.
6767
fn execute(&self, f: ~fn(&T)) {
6868
self.channels[self.next_index].send(Execute(move f));
@@ -72,12 +72,12 @@ pub impl<T> ThreadPool<T> {
7272
}
7373

7474
#[test]
75-
fn test_thread_pool() {
75+
fn test_task_pool() {
7676
let f: ~fn() -> ~fn(uint) -> uint = || {
7777
let g: ~fn(uint) -> uint = |i| i;
7878
move g
7979
};
80-
let pool = ThreadPool::new(4, Some(SingleThreaded), move f);
80+
let pool = TaskPool::new(4, Some(SingleThreaded), move f);
8181
for 8.times {
8282
pool.execute(|i| io::println(fmt!("Hello from thread %u!", *i)));
8383
}

0 commit comments

Comments
 (0)