Skip to content

Commit ad5bfd6

Browse files
committed
auto merge of #6387 : brson/rust/unstable, r=brson
r? @pcwalton * Move `SharedMutableState`, `LittleLock`, and `Exclusive` from `core::unstable` to `core::unstable::sync` * Modernize the `SharedMutableState` interface with methods * Rename `SharedMutableState` to `UnsafeAtomicRcBox` to match `RcBox`.
2 parents 3abc5b3 + 369231b commit ad5bfd6

File tree

13 files changed

+434
-424
lines changed

13 files changed

+434
-424
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/core.rc

+1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ pub mod util;
238238
/* Unsupported interfaces */
239239

240240
// Private APIs
241+
#[path = "unstable/mod.rs"]
241242
pub mod unstable;
242243

243244
/* For internal use, not exported */

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>;
@@ -855,7 +855,7 @@ pub fn change_dir(p: &Path) -> bool {
855855
/// is otherwise unsuccessful.
856856
pub fn change_dir_locked(p: &Path, action: &fn()) -> bool {
857857
use unstable::global::global_data_clone_create;
858-
use unstable::{Exclusive, exclusive};
858+
use unstable::sync::{Exclusive, exclusive};
859859
860860
fn key(_: Exclusive<()>) { }
861861

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,

0 commit comments

Comments
 (0)