about summary refs log tree commit diff
path: root/src/libstd/task_pool.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-03-24 12:41:19 -0400
committerAlex Crichton <alex@alexcrichton.com>2013-04-08 17:50:14 -0400
commit3136fba5aeca9184c944829596b93e45886fecf2 (patch)
treed8613aa519f2b5de0fa8d5a8bcb9841e6f0709f9 /src/libstd/task_pool.rs
parent5641777318239926363207f690bf265f7514a63c (diff)
downloadrust-3136fba5aeca9184c944829596b93e45886fecf2.tar.gz
rust-3136fba5aeca9184c944829596b93e45886fecf2.zip
Removing some mutable fields in libstd
Diffstat (limited to 'src/libstd/task_pool.rs')
-rw-r--r--src/libstd/task_pool.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libstd/task_pool.rs b/src/libstd/task_pool.rs
index aed6721b78e..3f2772942a5 100644
--- a/src/libstd/task_pool.rs
+++ b/src/libstd/task_pool.rs
@@ -26,8 +26,7 @@ enum Msg<T> {
 
 pub struct TaskPool<T> {
     channels: ~[Chan<Msg<T>>],
-    mut next_index: uint,
-
+    next_index: uint,
 }
 
 #[unsafe_destructor]
@@ -84,7 +83,7 @@ pub 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`.
-    fn execute(&self, f: ~fn(&T)) {
+    fn execute(&mut self, f: ~fn(&T)) {
         self.channels[self.next_index].send(Execute(f));
         self.next_index += 1;
         if self.next_index == self.channels.len() { self.next_index = 0; }
@@ -97,7 +96,7 @@ fn test_task_pool() {
         let g: ~fn(uint) -> uint = |i| i;
         g
     };
-    let pool = TaskPool::new(4, Some(SingleThreaded), f);
+    let mut pool = TaskPool::new(4, Some(SingleThreaded), f);
     for 8.times {
         pool.execute(|i| io::println(fmt!("Hello from thread %u!", *i)));
     }