Commit 8f1308f7 authored by Hai Dang's avatar Hai Dang
Browse files

rename iter_immut > iterate

parent 08701265
Pipeline #42490 passed with stage
in 22 minutes and 41 seconds
......@@ -60,7 +60,7 @@ mod atomic_cell {
next.next.store(old_node_next);
}
pub fn iter_immut(
pub fn iterate(
node: NodePtr<'arena, T>,
f: impl Fn(&T),
) {
......@@ -96,7 +96,7 @@ mod atomic_cell {
) {
(0..num_threads)
.into_par_iter()
.for_each(|_| Node::iter_immut(list, |n| print(n)));
.for_each(|_| Node::iterate(list, |n| print(n)));
}
}
......@@ -133,7 +133,7 @@ mod arena {
) {
(0..num_threads)
.into_par_iter()
.for_each(|_| Node::iter_immut(list, token, |n| print(n)));
.for_each(|_| Node::iterate(list, token, |n| print(n)));
}
pub fn par_inner(print: impl Fn(&u32) + Sync) {
......@@ -168,7 +168,7 @@ mod arc_ghost {
) {
(0..num_threads)
.into_par_iter()
.for_each(|_| Node::iter_immut(list, token, |n| f(n)));
.for_each(|_| Node::iterate(list, token, |n| f(n)));
}
}
......@@ -252,7 +252,7 @@ mod arc_rwlock {
next.next = old_node_next;
}
pub fn iter_immut(
pub fn iterate(
node: &NodePtr<T>,
f: impl Fn(&T),
) {
......@@ -285,7 +285,7 @@ mod arc_rwlock {
) {
(0..num_threads)
.into_par_iter()
.for_each(|_| Node::iter_immut(list, |n| f(n)));
.for_each(|_| Node::iterate(list, |n| f(n)));
}
}
......@@ -356,7 +356,7 @@ mod arena_rwlock {
next.next = old_node_next;
}
pub fn iter_immut(
pub fn iterate(
node: &NodePtr<'arena, T>,
f: impl Fn(&T),
) {
......@@ -391,7 +391,7 @@ mod arena_rwlock {
) {
(0..num_threads)
.into_par_iter()
.for_each(|_| Node::iter_immut(list, |n| f(n)));
.for_each(|_| Node::iterate(list, |n| f(n)));
}
}
......
......@@ -29,8 +29,8 @@ fn main() {
let list = init_list(&mut token, 50);
rayon::join(
|| Node::iter_immut(&list, &token, |n| print!("{:?}, ", n)),
|| Node::iter_immut(&list, &token, |n| print!("{:?}, ", n)),
|| Node::iterate(&list, &token, |n| print!("{:?}, ", n)),
|| Node::iterate(&list, &token, |n| print!("{:?}, ", n)),
);
// We can put a RwLock on the token to allow concurrent writes and reads.
......@@ -41,7 +41,7 @@ fn main() {
// fork two child threads
|| {
let token: &GhostToken = &lock_token.read().unwrap(); // acquire read lock
Node::iter_immut(&list, token, |n| print!("{:?}, ", n));
Node::iterate(&list, token, |n| print!("{:?}, ", n));
},
|| {
let token: &mut GhostToken = &mut lock_token.write().unwrap(); // acquire write lock
......
......@@ -66,7 +66,7 @@ mod arena_rwlock {
next.next = old_node_next;
}
pub fn iter_immut(
pub fn iterate(
node: &NodePtr<'arena, T>,
f: impl Fn(&T),
) {
......@@ -101,7 +101,7 @@ mod arena_rwlock {
) {
(0..num_threads)
.into_par_iter()
.for_each(|_| Node::iter_immut(list, |n| f(n)));
.for_each(|_| Node::iterate(list, |n| f(n)));
}
}
......@@ -185,7 +185,7 @@ mod arc_rwlock {
next.next = old_node_next;
}
pub fn iter_immut(
pub fn iterate(
node: &NodePtr<T>,
f: impl Fn(&T),
) {
......@@ -219,7 +219,7 @@ mod arc_rwlock {
) {
(0..num_threads)
.into_par_iter()
.for_each(|_| Node::iter_immut(list, |n| f(n)));
.for_each(|_| Node::iterate(list, |n| f(n)));
}
}
......@@ -229,7 +229,7 @@ use std::fmt;
// fn print_list<T: fmt::Debug>(list: &NodePtr<T>) {
// print!("[");
// Node::iter_immut(&list, |n| print!("{:?}, ", n));
// Node::iterate(&list, |n| print!("{:?}, ", n));
// print!("]");
// }
......@@ -258,7 +258,7 @@ use typed_arena::Arena as TypedArena;
fn print_list<'arena, T: fmt::Debug>(list: NodePtr<'arena, T>) {
print!("[");
Node::iter_immut(&list, |n| print!("{:?}, ", n));
Node::iterate(&list, |n| print!("{:?}, ", n));
print!("]");
}
......
......@@ -97,7 +97,7 @@ impl<'id, T> Node<'id, T> {
}
}
pub fn iter_immut(
pub fn iterate(
node: &NodePtr<'id, T>,
token: &GhostToken<'id>,
f: impl Fn(&T),
......
......@@ -98,7 +98,7 @@ impl<'arena, 'id, T> Node<'arena, 'id, T> {
}
}
pub fn iter_immut(
pub fn iterate(
node: NodeRef<'arena, 'id, T>,
token: &GhostToken<'id>,
f: impl Fn(&T),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment