Skip to content

Commit fa1d047

Browse files
committed
core: Move locks, atomic rc to unstable::sync
1 parent 4f44624 commit fa1d047

File tree

11 files changed

+313
-295
lines changed

11 files changed

+313
-295
lines changed

src/libcore/comm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use option::{Option, Some, None};
1919
use uint;
2020
use unstable;
2121
use vec;
22-
use unstable::Exclusive;
2322
use util::replace;
23+
use unstable::sync::{Exclusive, exclusive};
2424

2525
use pipes::{recv, try_recv, wait_many, peek, PacketHeader};
2626

@@ -304,7 +304,7 @@ pub struct SharedChan<T> {
304304
impl<T: Owned> SharedChan<T> {
305305
/// Converts a `chan` into a `shared_chan`.
306306
pub fn new(c: Chan<T>) -> SharedChan<T> {
307-
SharedChan { ch: unstable::exclusive(c) }
307+
SharedChan { ch: exclusive(c) }
308308
}
309309
}
310310

src/libcore/os.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ FIXME #4726: It would probably be appropriate to make this a real global
152152
*/
153153
fn with_env_lock<T>(f: &fn() -> T) -> T {
154154
use unstable::global::global_data_clone_create;
155-
use unstable::{Exclusive, exclusive};
155+
use unstable::sync::{Exclusive, exclusive};
156156

157157
struct SharedValue(());
158158
type ValueMutex = Exclusive<SharedValue>;
@@ -860,7 +860,7 @@ pub fn change_dir(p: &Path) -> bool {
860860
/// is otherwise unsuccessful.
861861
pub fn change_dir_locked(p: &Path, action: &fn()) -> bool {
862862
use unstable::global::global_data_clone_create;
863-
use unstable::{Exclusive, exclusive};
863+
use unstable::sync::{Exclusive, exclusive};
864864
865865
fn key(_: Exclusive<()>) { }
866866

src/libcore/task/spawn.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ use task::{ExistingScheduler, SchedulerHandle};
9090
use task::unkillable;
9191
use uint;
9292
use util;
93+
use unstable::sync::{Exclusive, exclusive};
9394

9495
#[cfg(test)] use task::default_task_opts;
9596

@@ -128,7 +129,7 @@ struct TaskGroupData {
128129
// tasks in this group.
129130
descendants: TaskSet,
130131
}
131-
type TaskGroupArc = unstable::Exclusive<Option<TaskGroupData>>;
132+
type TaskGroupArc = Exclusive<Option<TaskGroupData>>;
132133

133134
type TaskGroupInner<'self> = &'self mut Option<TaskGroupData>;
134135

@@ -158,7 +159,7 @@ struct AncestorNode {
158159
ancestors: AncestorList,
159160
}
160161

161-
struct AncestorList(Option<unstable::Exclusive<AncestorNode>>);
162+
struct AncestorList(Option<Exclusive<AncestorNode>>);
162163

163164
// Accessors for taskgroup arcs and ancestor arcs that wrap the unsafety.
164165
#[inline(always)]
@@ -167,7 +168,7 @@ fn access_group<U>(x: &TaskGroupArc, blk: &fn(TaskGroupInner) -> U) -> U {
167168
}
168169

169170
#[inline(always)]
170-
fn access_ancestors<U>(x: &unstable::Exclusive<AncestorNode>,
171+
fn access_ancestors<U>(x: &Exclusive<AncestorNode>,
171172
blk: &fn(x: &mut AncestorNode) -> U) -> U {
172173
x.with(blk)
173174
}
@@ -479,7 +480,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
479480
// here.
480481
let mut members = new_taskset();
481482
taskset_insert(&mut members, spawner);
482-
let tasks = unstable::exclusive(Some(TaskGroupData {
483+
let tasks = exclusive(Some(TaskGroupData {
483484
members: members,
484485
descendants: new_taskset(),
485486
}));
@@ -508,7 +509,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
508509
(g, a, spawner_group.is_main)
509510
} else {
510511
// Child is in a separate group from spawner.
511-
let g = unstable::exclusive(Some(TaskGroupData {
512+
let g = exclusive(Some(TaskGroupData {
512513
members: new_taskset(),
513514
descendants: new_taskset(),
514515
}));
@@ -528,7 +529,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
528529
};
529530
assert!(new_generation < uint::max_value);
530531
// Build a new node in the ancestor list.
531-
AncestorList(Some(unstable::exclusive(AncestorNode {
532+
AncestorList(Some(exclusive(AncestorNode {
532533
generation: new_generation,
533534
parent_group: Some(spawner_group.tasks.clone()),
534535
ancestors: old_ancestors,

src/libcore/unstable/global.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ use kinds::Owned;
3131
use libc::{c_void};
3232
use option::{Option, Some, None};
3333
use ops::Drop;
34-
use unstable::{Exclusive, exclusive};
34+
use unstable::sync::{Exclusive, exclusive};
3535
use unstable::at_exit::at_exit;
3636
use unstable::intrinsics::atomic_cxchg;
3737
use hashmap::HashMap;
3838
use sys::Closure;
3939

40-
#[cfg(test)] use unstable::{SharedMutableState, shared_mutable_state};
41-
#[cfg(test)] use unstable::get_shared_immutable_state;
40+
#[cfg(test)] use unstable::sync::{SharedMutableState, shared_mutable_state};
41+
#[cfg(test)] use unstable::sync::get_shared_immutable_state;
4242
#[cfg(test)] use task::spawn;
4343
#[cfg(test)] use uint;
4444

0 commit comments

Comments
 (0)