Skip to content

Commit 4d3dd29

Browse files
committed
---
yaml --- r: 121343 b: refs/heads/dist-snap c: af520e1 h: refs/heads/master i: 121341: 82346cf 121339: bb80f82 121335: 5ab6cf5 121327: 7e74e5d 121311: 05120dc 121279: eefc5b4 121215: 82c2e21 121087: 400b84b 120831: 76f8d66 v: v3
1 parent f9db56f commit 4d3dd29

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 1813e5aa1a03b0596b8de7abd1af31edf5d6098f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: a7a18dee72f3aace13e90381139b6ccd351feef7
9+
refs/heads/dist-snap: af520e133c24f9409f85ac91b0b8bbf033ec0b7a
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/doc/index.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,12 @@ li {list-style-type: none; }
6767

6868
* [The `rustdoc` manual](rustdoc.html)
6969

70-
# External documentation
70+
# External resources
7171

72-
*Note: While these are great resources for learning Rust, they may
73-
track a particular version of Rust that is likely not exactly the same
74-
as that for which this documentation was generated.*
75-
76-
* [Rust for Rubyists] - An excellent introduction for Rust; not just for Rubyists (tracks the most recent release).
77-
* [Rust by Example] - Short examples of common tasks in Rust (tracks the master branch).
78-
* [The Rust wiki](http://github.com/rust-lang/rust/wiki)
79-
80-
[Rust for Rubyists]: http://www.rustforrubyists.com/
81-
[Rust by Example]: http://rustbyexample.com/
82-
83-
# Community
84-
85-
* [Reddit](http://reddit.com/r/rust)
86-
* [Stack Overflow](http://stackoverflow.com/questions/tagged/rust)
87-
* The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/):
72+
* The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/)
8873
* [`#rust`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) - general discussion
8974
* [`#rust-gamedev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-gamedev) - game development
9075
* [`#rust-internals`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals) - compiler and libraries
9176
* [`#rust-osdev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-osdev) - operating system development
92-
77+
* The Rust community on [Reddit](http://reddit.com/r/rust)
78+
* The Rust [wiki](http://github.com/rust-lang/rust/wiki)

branches/dist-snap/src/libstd/sync/task_pool.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(missing_doc)]
12-
13-
/// A task pool abstraction. Useful for achieving predictable CPU
14-
/// parallelism.
11+
//! Abstraction of a task pool for basic parallelism.
1512
1613
use core::prelude::*;
1714

@@ -25,6 +22,7 @@ enum Msg<T> {
2522
Quit
2623
}
2724

25+
/// A task pool used to execute functions in parallel.
2826
pub struct TaskPool<T> {
2927
channels: Vec<Sender<Msg<T>>>,
3028
next_index: uint,
@@ -40,11 +38,13 @@ impl<T> Drop for TaskPool<T> {
4038
}
4139

4240
impl<T> TaskPool<T> {
43-
/// Spawns a new task pool with `n_tasks` tasks. If the `sched_mode`
44-
/// is None, the tasks run on this scheduler; otherwise, they run on a
45-
/// new scheduler with the given mode. The provided `init_fn_factory`
46-
/// returns a function which, given the index of the task, should return
47-
/// local data to be kept around in that task.
41+
/// Spawns a new task pool with `n_tasks` tasks. The provided
42+
/// `init_fn_factory` returns a function which, given the index of the
43+
/// task, should return local data to be kept around in that task.
44+
///
45+
/// # Failure
46+
///
47+
/// This function will fail if `n_tasks` is less than 1.
4848
pub fn new(n_tasks: uint,
4949
init_fn_factory: || -> proc(uint):Send -> T)
5050
-> TaskPool<T> {
@@ -87,12 +87,16 @@ impl<T> TaskPool<T> {
8787

8888
#[test]
8989
fn test_task_pool() {
90-
let f: || -> proc(uint):Send -> uint = || {
91-
let g: proc(uint):Send -> uint = proc(i) i;
92-
g
93-
};
90+
let f: || -> proc(uint):Send -> uint = || { proc(i) i };
9491
let mut pool = TaskPool::new(4, f);
9592
for _ in range(0, 8) {
9693
pool.execute(proc(i) println!("Hello from thread {}!", *i));
9794
}
9895
}
96+
97+
#[test]
98+
#[should_fail]
99+
fn test_zero_tasks_failure() {
100+
let f: || -> proc(uint):Send -> uint = || { proc(i) i };
101+
TaskPool::new(0, f);
102+
}

0 commit comments

Comments
 (0)