Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
FP
ghostcell
Commits
8f1308f7
Commit
8f1308f7
authored
Feb 26, 2021
by
Hai Dang
Browse files
rename iter_immut > iterate
parent
08701265
Pipeline
#42490
passed with stage
in 22 minutes and 41 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ghostcell/benches/dlist.rs
View file @
8f1308f7
...
...
@@ -60,7 +60,7 @@ mod atomic_cell {
next
.next
.store
(
old_node_next
);
}
pub
fn
iter
_immut
(
pub
fn
iter
ate
(
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
::
iter
ate
(
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
::
iter
ate
(
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
::
iter
ate
(
list
,
token
,
|
n
|
f
(
n
)));
}
}
...
...
@@ -252,7 +252,7 @@ mod arc_rwlock {
next
.next
=
old_node_next
;
}
pub
fn
iter
_immut
(
pub
fn
iter
ate
(
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
::
iter
ate
(
list
,
|
n
|
f
(
n
)));
}
}
...
...
@@ -356,7 +356,7 @@ mod arena_rwlock {
next
.next
=
old_node_next
;
}
pub
fn
iter
_immut
(
pub
fn
iter
ate
(
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
::
iter
ate
(
list
,
|
n
|
f
(
n
)));
}
}
...
...
ghostcell/examples/dlist_arc_paper.rs
View file @
8f1308f7
...
...
@@ -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
::
iter
ate
(
&
list
,
&
token
,
|
n
|
print!
(
"{:?}, "
,
n
)),
||
Node
::
iter
ate
(
&
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
::
iter
ate
(
&
list
,
token
,
|
n
|
print!
(
"{:?}, "
,
n
));
},
||
{
let
token
:
&
mut
GhostToken
=
&
mut
lock_token
.write
()
.unwrap
();
// acquire write lock
...
...
ghostcell/examples/dlist_rwlock.rs
View file @
8f1308f7
...
...
@@ -66,7 +66,7 @@ mod arena_rwlock {
next
.next
=
old_node_next
;
}
pub
fn
iter
_immut
(
pub
fn
iter
ate
(
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
::
iter
ate
(
list
,
|
n
|
f
(
n
)));
}
}
...
...
@@ -185,7 +185,7 @@ mod arc_rwlock {
next
.next
=
old_node_next
;
}
pub
fn
iter
_immut
(
pub
fn
iter
ate
(
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
::
iter
ate
(
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::iter
ate
(&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
::
iter
ate
(
&
list
,
|
n
|
print!
(
"{:?}, "
,
n
));
print!
(
"]"
);
}
...
...
ghostcell/src/dlist_arc.rs
View file @
8f1308f7
...
...
@@ -97,7 +97,7 @@ impl<'id, T> Node<'id, T> {
}
}
pub
fn
iter
_immut
(
pub
fn
iter
ate
(
node
:
&
NodePtr
<
'id
,
T
>
,
token
:
&
GhostToken
<
'id
>
,
f
:
impl
Fn
(
&
T
),
...
...
ghostcell/src/dlist_arena.rs
View file @
8f1308f7
...
...
@@ -98,7 +98,7 @@ impl<'arena, 'id, T> Node<'arena, 'id, T> {
}
}
pub
fn
iter
_immut
(
pub
fn
iter
ate
(
node
:
NodeRef
<
'arena
,
'id
,
T
>
,
token
:
&
GhostToken
<
'id
>
,
f
:
impl
Fn
(
&
T
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment