Skip to content
4 changes: 2 additions & 2 deletions doc/tutorial-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ an intermediate generation has already exited:
~~~
# use std::task;
# fn sleep_forever() { loop { task::yield() } }
# fn wait_for_a_while() { for 1000.times { task::yield() } }
# fn wait_for_a_while() { do 1000.times { task::yield() } }
# do task::try::<int> {
do task::spawn_supervised {
do task::spawn_supervised {
Expand All @@ -567,7 +567,7 @@ other at all, using `task::spawn_unlinked` for _isolated failure_.
~~~
# use std::task;
# fn random() -> uint { 100 }
# fn sleep_for(i: uint) { for i.times { task::yield() } }
# fn sleep_for(i: uint) { do i.times { task::yield() } }
# do task::try::<()> {
let (time1, time2) = (random(), random());
do task::spawn_unlinked {
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -1899,7 +1899,7 @@ struct TimeBomb {

impl Drop for TimeBomb {
fn drop(&self) {
for self.explosivity.times {
do self.explosivity.times {
println("blam!");
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* let numbers=vec::from_fn(100, |ind| (ind as float)*rand::random());
* let shared_numbers=arc::Arc::new(numbers);
*
* for 10.times {
* do 10.times {
* let (port, chan) = stream();
* chan.send(shared_numbers.clone());
*
Expand Down Expand Up @@ -765,7 +765,7 @@ mod tests {

do task::spawn || {
do arc2.write |num| {
for 10.times {
do 10.times {
let tmp = *num;
*num = -1;
task::yield();
Expand All @@ -777,7 +777,7 @@ mod tests {

// Readers try to catch the writer in the act
let mut children = ~[];
for 5.times {
do 5.times {
let arc3 = (*arc).clone();
let mut builder = task::task();
builder.future_result(|r| children.push(r));
Expand Down Expand Up @@ -811,7 +811,7 @@ mod tests {

// Reader tasks
let mut reader_convos = ~[];
for 10.times {
do 10.times {
let ((rp1,rc1),(rp2,rc2)) = (comm::stream(),comm::stream());
reader_convos.push((rc1, rp2));
let arcn = (*arc).clone();
Expand Down Expand Up @@ -925,7 +925,7 @@ mod tests {
do read_mode.read |state| {
// if writer mistakenly got in, make sure it mutates state
// before we assert on it
for 5.times { task::yield(); }
do 5.times { task::yield(); }
// make sure writer didn't get in.
assert!(*state);
}
Expand All @@ -937,6 +937,6 @@ mod tests {
// helped to expose the race nearly 100% of the time... but adding
// yields in the intuitively-right locations made it even less likely,
// and I wasn't sure why :( . This is a mediocre "next best" option.
for 8.times { test_rw_write_cond_downgrade_read_race_helper() }
do 8.times { test_rw_write_cond_downgrade_read_race_helper() }
}
}
5 changes: 3 additions & 2 deletions src/libextra/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ impl Drop for Arena {
fn drop(&self) {
unsafe {
destroy_chunk(&self.head);
for self.chunks.each |chunk| {
do self.chunks.each |chunk| {
if !chunk.is_pod {
destroy_chunk(chunk);
}
}
true
};
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ mod test {
use std::rand::{task_rng, random, RngUtil};
use std::vec;

for 1000.times {
do 1000.times {
let v: ~[u8] = do vec::build |push| {
for task_rng().gen_uint_range(1, 100).times {
do task_rng().gen_uint_range(1, 100).times {
push(random());
}
};
Expand Down Expand Up @@ -389,4 +389,4 @@ mod test {
bh.bytes = b.len() as u64;
}

}
}
Loading