Change concurrency primitives to standard naming conventions
To be more specific: `UPPERCASETYPE` was changed to `UppercaseType` `type_new` was changed to `Type::new` `type_function(value)` was changed to `value.method()`
This commit is contained in:
parent
3078e83c3f
commit
d0b7515aed
41 changed files with 435 additions and 431 deletions
|
|
@ -230,7 +230,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
|
|||
}
|
||||
|
||||
/// A parallel version of the bfs function.
|
||||
fn pbfs(graph: &arc::ARC<graph>, key: node_id) -> bfs_result {
|
||||
fn pbfs(graph: &arc::Arc<graph>, key: node_id) -> bfs_result {
|
||||
// This works by doing functional updates of a color vector.
|
||||
|
||||
let graph_vec = graph.get(); // FIXME #3387 requires this temp
|
||||
|
|
@ -263,7 +263,7 @@ fn pbfs(graph: &arc::ARC<graph>, key: node_id) -> bfs_result {
|
|||
i += 1;
|
||||
let old_len = colors.len();
|
||||
|
||||
let color = arc::ARC(colors);
|
||||
let color = arc::Arc::new(colors);
|
||||
|
||||
let color_vec = color.get(); // FIXME #3387 requires this temp
|
||||
colors = do par::mapi(*color_vec) {
|
||||
|
|
@ -444,7 +444,7 @@ fn main() {
|
|||
let mut total_seq = 0.0;
|
||||
let mut total_par = 0.0;
|
||||
|
||||
let graph_arc = arc::ARC(graph.clone());
|
||||
let graph_arc = arc::Arc::new(graph.clone());
|
||||
|
||||
do gen_search_keys(graph, num_keys).map() |root| {
|
||||
io::stdout().write_line("");
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
// This test creates a bunch of tasks that simultaneously send to each
|
||||
// other in a ring. The messages should all be basically
|
||||
// independent.
|
||||
// This is like msgsend-ring-pipes but adapted to use ARCs.
|
||||
// This is like msgsend-ring-pipes but adapted to use Arcs.
|
||||
|
||||
// This also serves as a pipes test, because ARCs are implemented with pipes.
|
||||
// This also serves as a pipes test, because Arcs are implemented with pipes.
|
||||
|
||||
extern mod extra;
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ use std::os;
|
|||
use std::uint;
|
||||
|
||||
// A poor man's pipe.
|
||||
type pipe = arc::MutexARC<~[uint]>;
|
||||
type pipe = arc::MutexArc<~[uint]>;
|
||||
|
||||
fn send(p: &pipe, msg: uint) {
|
||||
unsafe {
|
||||
|
|
@ -48,7 +48,7 @@ fn recv(p: &pipe) -> uint {
|
|||
}
|
||||
|
||||
fn init() -> (pipe,pipe) {
|
||||
let m = arc::MutexARC(~[]);
|
||||
let m = arc::MutexArc::new(~[]);
|
||||
((&m).clone(), m)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
// This test creates a bunch of tasks that simultaneously send to each
|
||||
// other in a ring. The messages should all be basically
|
||||
// independent.
|
||||
// This is like msgsend-ring-pipes but adapted to use ARCs.
|
||||
// This is like msgsend-ring-pipes but adapted to use Arcs.
|
||||
|
||||
// This also serves as a pipes test, because ARCs are implemented with pipes.
|
||||
// This also serves as a pipes test, because Arcs are implemented with pipes.
|
||||
|
||||
extern mod extra;
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ use std::os;
|
|||
use std::uint;
|
||||
|
||||
// A poor man's pipe.
|
||||
type pipe = arc::RWARC<~[uint]>;
|
||||
type pipe = arc::RWArc<~[uint]>;
|
||||
|
||||
fn send(p: &pipe, msg: uint) {
|
||||
do p.write_cond |state, cond| {
|
||||
|
|
@ -44,7 +44,7 @@ fn recv(p: &pipe) -> uint {
|
|||
}
|
||||
|
||||
fn init() -> (pipe,pipe) {
|
||||
let x = arc::RWARC(~[]);
|
||||
let x = arc::RWArc::new(~[]);
|
||||
((&x).clone(), x)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
extern mod extra;
|
||||
use extra::arc;
|
||||
fn main() {
|
||||
let x = ~arc::RWARC(1);
|
||||
let x = ~arc::RWArc::new(1);
|
||||
let mut y = None;
|
||||
do x.write_cond |_one, cond| {
|
||||
y = Some(cond);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
extern mod extra;
|
||||
use extra::arc;
|
||||
fn main() {
|
||||
let x = ~arc::RWARC(1);
|
||||
let x = ~arc::RWArc::new(1);
|
||||
let mut y = None;
|
||||
do x.write_downgrade |write_mode| {
|
||||
y = Some(x.downgrade(write_mode));
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
extern mod extra;
|
||||
use extra::arc;
|
||||
fn main() {
|
||||
let x = ~arc::RWARC(1);
|
||||
let x = ~arc::RWArc::new(1);
|
||||
let mut y = None; //~ ERROR lifetime of variable does not enclose its declaration
|
||||
do x.write |one| {
|
||||
y = Some(one);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
extern mod extra;
|
||||
use extra::arc;
|
||||
fn main() {
|
||||
let x = ~arc::RWARC(1);
|
||||
let x = ~arc::RWArc::new(1);
|
||||
let mut y = None;
|
||||
do x.write_downgrade |write_mode| {
|
||||
do (&write_mode).write_cond |_one, cond| {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
extern mod extra;
|
||||
use extra::arc;
|
||||
fn main() {
|
||||
let x = ~arc::RWARC(1);
|
||||
let x = ~arc::RWArc::new(1);
|
||||
let mut y = None;
|
||||
do x.write_downgrade |write_mode| {
|
||||
y = Some(write_mode);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use std::task;
|
|||
|
||||
fn main() {
|
||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
let arc_v = arc::ARC(v);
|
||||
let arc_v = arc::Arc::new(v);
|
||||
|
||||
do task::spawn() {
|
||||
let v = arc_v.get();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use std::task;
|
|||
|
||||
fn main() {
|
||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
let arc_v = arc::ARC(v);
|
||||
let arc_v = arc::Arc::new(v);
|
||||
|
||||
do task::spawn() {
|
||||
let v = arc_v.get();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn foo(blk: ~once fn()) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = arc::ARC(true);
|
||||
let x = arc::Arc::new(true);
|
||||
do foo {
|
||||
assert!(*x.get());
|
||||
util::ignore(x);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fn foo(blk: &once fn()) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = arc::ARC(true);
|
||||
let x = arc::Arc::new(true);
|
||||
do foo {
|
||||
assert!(*x.get());
|
||||
util::ignore(x);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn foo(blk: ~fn()) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = arc::ARC(true);
|
||||
let x = arc::Arc::new(true);
|
||||
do foo {
|
||||
assert!(*x.get());
|
||||
util::ignore(x); //~ ERROR cannot move out of captured outer variable
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn foo(blk: &fn()) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = arc::ARC(true);
|
||||
let x = arc::Arc::new(true);
|
||||
do foo {
|
||||
assert!(*x.get());
|
||||
util::ignore(x); //~ ERROR cannot move out of captured outer variable
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ extern mod extra;
|
|||
use extra::sync;
|
||||
|
||||
fn main() {
|
||||
let m = ~sync::Mutex();
|
||||
let m = ~sync::Mutex::new();
|
||||
let mut cond = None;
|
||||
do m.lock_cond |c| {
|
||||
cond = Some(c);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
extern mod extra;
|
||||
use extra::sync;
|
||||
fn main() {
|
||||
let x = ~sync::RWlock();
|
||||
let x = ~sync::RWLock::new();
|
||||
let mut y = None;
|
||||
do x.write_cond |cond| {
|
||||
y = Some(cond);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
extern mod extra;
|
||||
use extra::sync;
|
||||
fn main() {
|
||||
let x = ~sync::RWlock();
|
||||
let x = ~sync::RWLock::new();
|
||||
let mut y = None;
|
||||
do x.write_downgrade |write_mode| {
|
||||
y = Some(x.downgrade(write_mode));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
extern mod extra;
|
||||
use extra::sync;
|
||||
fn main() {
|
||||
let x = ~sync::RWlock();
|
||||
let x = ~sync::RWLock::new();
|
||||
let mut y = None;
|
||||
do x.write_downgrade |write_mode| {
|
||||
do (&write_mode).write_cond |cond| {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
extern mod extra;
|
||||
use extra::sync;
|
||||
fn main() {
|
||||
let x = ~sync::RWlock();
|
||||
let x = ~sync::RWLock::new();
|
||||
let mut y = None;
|
||||
do x.write_downgrade |write_mode| {
|
||||
y = Some(write_mode);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
extern mod extra;
|
||||
use extra::arc;
|
||||
|
||||
enum e<T> { e(arc::ARC<T>) }
|
||||
enum e<T> { e(arc::Arc<T>) }
|
||||
|
||||
fn foo() -> e<int> {fail!();}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@
|
|||
// xfail-fast
|
||||
extern mod extra;
|
||||
use extra::arc;
|
||||
fn dispose(_x: arc::ARC<bool>) { unsafe { } }
|
||||
fn dispose(_x: arc::Arc<bool>) { unsafe { } }
|
||||
|
||||
pub fn main() {
|
||||
let p = arc::ARC(true);
|
||||
let p = arc::Arc::new(true);
|
||||
let x = Some(p);
|
||||
match x {
|
||||
Some(z) => { dispose(z); },
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use std::unstable;
|
|||
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
let x = Some(unstable::sync::exclusive(true));
|
||||
let x = Some(unstable::sync::Exclusive::new(true));
|
||||
match x {
|
||||
Some(ref z) if z.with(|b| *b) => {
|
||||
do z.with |b| { assert!(*b); }
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fn foo(blk: ~once fn()) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = arc::ARC(true);
|
||||
let x = arc::Arc::new(true);
|
||||
do foo {
|
||||
assert!(*x.get());
|
||||
util::ignore(x);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fn foo(blk: &once fn()) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = arc::ARC(true);
|
||||
let x = arc::Arc::new(true);
|
||||
do foo {
|
||||
assert!(*x.get());
|
||||
util::ignore(x);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Tests that a heterogeneous list of existential types can be put inside an ARC
|
||||
// Tests that a heterogeneous list of existential types can be put inside an Arc
|
||||
// and shared between tasks as long as all types fulfill Freeze+Send.
|
||||
|
||||
// xfail-fast
|
||||
|
|
@ -64,7 +64,7 @@ fn main() {
|
|||
let dogge1 = Dogge { bark_decibels: 100, tricks_known: 42, name: ~"alan_turing" };
|
||||
let dogge2 = Dogge { bark_decibels: 55, tricks_known: 11, name: ~"albert_einstein" };
|
||||
let fishe = Goldfyshe { swim_speed: 998, name: ~"alec_guinness" };
|
||||
let arc = arc::ARC(~[~catte as ~Pet:Freeze+Send,
|
||||
let arc = arc::Arc::new(~[~catte as ~Pet:Freeze+Send,
|
||||
~dogge1 as ~Pet:Freeze+Send,
|
||||
~fishe as ~Pet:Freeze+Send,
|
||||
~dogge2 as ~Pet:Freeze+Send]);
|
||||
|
|
@ -82,21 +82,21 @@ fn main() {
|
|||
p3.recv();
|
||||
}
|
||||
|
||||
fn check_legs(arc: arc::ARC<~[~Pet:Freeze+Send]>) {
|
||||
fn check_legs(arc: arc::Arc<~[~Pet:Freeze+Send]>) {
|
||||
let mut legs = 0;
|
||||
for arc.get().iter().advance |pet| {
|
||||
legs += pet.num_legs();
|
||||
}
|
||||
assert!(legs == 12);
|
||||
}
|
||||
fn check_names(arc: arc::ARC<~[~Pet:Freeze+Send]>) {
|
||||
fn check_names(arc: arc::Arc<~[~Pet:Freeze+Send]>) {
|
||||
for arc.get().iter().advance |pet| {
|
||||
do pet.name |name| {
|
||||
assert!(name[0] == 'a' as u8 && name[1] == 'l' as u8);
|
||||
}
|
||||
}
|
||||
}
|
||||
fn check_pedigree(arc: arc::ARC<~[~Pet:Freeze+Send]>) {
|
||||
fn check_pedigree(arc: arc::Arc<~[~Pet:Freeze+Send]>) {
|
||||
for arc.get().iter().advance |pet| {
|
||||
assert!(pet.of_good_pedigree());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ fn f(p: &mut Point) { p.z = 13; }
|
|||
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
let x = Some(unstable::sync::exclusive(true));
|
||||
let x = Some(unstable::sync::Exclusive::new(true));
|
||||
match x {
|
||||
Some(ref z) if z.with(|b| *b) => {
|
||||
do z.with |b| { assert!(*b); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue