Fix fallout of removing default bounds
This is all purely fallout of getting the previous commit to compile.
This commit is contained in:
parent
bdd24b2a56
commit
bb9172d7b5
61 changed files with 378 additions and 364 deletions
|
|
@ -16,7 +16,7 @@
|
|||
use std::task;
|
||||
|
||||
enum Msg<T> {
|
||||
Execute(proc(&T)),
|
||||
Execute(proc:Send(&T)),
|
||||
Quit
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ impl<T> TaskPool<T> {
|
|||
/// returns a function which, given the index of the task, should return
|
||||
/// local data to be kept around in that task.
|
||||
pub fn new(n_tasks: uint,
|
||||
init_fn_factory: || -> proc(uint) -> T)
|
||||
init_fn_factory: || -> proc:Send(uint) -> T)
|
||||
-> TaskPool<T> {
|
||||
assert!(n_tasks >= 1);
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ impl<T> TaskPool<T> {
|
|||
let (tx, rx) = channel::<Msg<T>>();
|
||||
let init_fn = init_fn_factory();
|
||||
|
||||
let task_body: proc() = proc() {
|
||||
let task_body = proc() {
|
||||
let local_data = init_fn(i);
|
||||
loop {
|
||||
match rx.recv() {
|
||||
|
|
@ -73,7 +73,7 @@ impl<T> TaskPool<T> {
|
|||
|
||||
/// Executes the function `f` on a task in the pool. The function
|
||||
/// receives a reference to the local data returned by the `init_fn`.
|
||||
pub fn execute(&mut self, f: proc(&T)) {
|
||||
pub fn execute(&mut self, f: proc:Send(&T)) {
|
||||
self.channels.get(self.next_index).send(Execute(f));
|
||||
self.next_index += 1;
|
||||
if self.next_index == self.channels.len() { self.next_index = 0; }
|
||||
|
|
@ -82,8 +82,8 @@ impl<T> TaskPool<T> {
|
|||
|
||||
#[test]
|
||||
fn test_task_pool() {
|
||||
let f: || -> proc(uint) -> uint = || {
|
||||
let g: proc(uint) -> uint = proc(i) i;
|
||||
let f: || -> proc:Send(uint) -> uint = || {
|
||||
let g: proc:Send(uint) -> uint = proc(i) i;
|
||||
g
|
||||
};
|
||||
let mut pool = TaskPool::new(4, f);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue