Skip to content

Commit ca00877

Browse files
committed
---
yaml --- r: 40393 b: refs/heads/dist-snap c: 9b6f025 h: refs/heads/master i: 40391: 8982b21 v: v3
1 parent eecc15f commit ca00877

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
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: a0610c952f0d23927443b901241627ae910fd3cd
10+
refs/heads/dist-snap: 9b6f025eb607aab8ea29c2033dcebe1d263ba614
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/src/libstd/thread_pool.rs renamed to branches/dist-snap/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)