about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-27 13:20:47 -0700
committerbors <bors@rust-lang.org>2013-08-27 13:20:47 -0700
commit3ab0561b00d2993706d11bfbbce4a357110195dd (patch)
tree7536debfcd076b92e9eb6b0c8b871eac1be22129 /src/libstd/rt
parentc822d1070ac39871165df30ac8d09e733a6e7fb9 (diff)
parenta79575529de2c6c74b430cd2d9e2d8833eac2f82 (diff)
downloadrust-3ab0561b00d2993706d11bfbbce4a357110195dd.tar.gz
rust-3ab0561b00d2993706d11bfbbce4a357110195dd.zip
auto merge of #8790 : huonw/rust/unsafearc, r=thestinger
`UnsafeAtomicRcBox` &rarr; `UnsafeArc` (#7674), and `AtomicRcBoxData` &rarr; `ArcData` to reflect this.

Also, the inner pointer of `UnsafeArc` is now `*mut ArcData`, which avoids some transmutes to `~`: i.e. less chance of mistakes.
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/comm.rs10
-rw-r--r--src/libstd/rt/kill.rs14
-rw-r--r--src/libstd/rt/message_queue.rs6
-rw-r--r--src/libstd/rt/mod.rs4
-rw-r--r--src/libstd/rt/sleeper_list.rs6
5 files changed, 20 insertions, 20 deletions
diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs
index bd83e286156..b547d3c9c30 100644
--- a/src/libstd/rt/comm.rs
+++ b/src/libstd/rt/comm.rs
@@ -21,7 +21,7 @@ use rt::local::Local;
 use rt::select::{SelectInner, SelectPortInner};
 use select::{Select, SelectPort};
 use unstable::atomics::{AtomicUint, AtomicOption, Acquire, Relaxed, SeqCst};
-use unstable::sync::UnsafeAtomicRcBox;
+use unstable::sync::UnsafeArc;
 use util::Void;
 use comm::{GenericChan, GenericSmartChan, GenericPort, Peekable};
 use cell::Cell;
@@ -567,14 +567,14 @@ impl<'self, T> SelectPort<T> for &'self Port<T> { }
 
 pub struct SharedChan<T> {
     // Just like Chan, but a shared AtomicOption instead of Cell
-    priv next: UnsafeAtomicRcBox<AtomicOption<StreamChanOne<T>>>
+    priv next: UnsafeArc<AtomicOption<StreamChanOne<T>>>
 }
 
 impl<T> SharedChan<T> {
     pub fn new(chan: Chan<T>) -> SharedChan<T> {
         let next = chan.next.take();
         let next = AtomicOption::new(~next);
-        SharedChan { next: UnsafeAtomicRcBox::new(next) }
+        SharedChan { next: UnsafeArc::new(next) }
     }
 }
 
@@ -620,7 +620,7 @@ impl<T> Clone for SharedChan<T> {
 
 pub struct SharedPort<T> {
     // The next port on which we will receive the next port on which we will receive T
-    priv next_link: UnsafeAtomicRcBox<AtomicOption<PortOne<StreamPortOne<T>>>>
+    priv next_link: UnsafeArc<AtomicOption<PortOne<StreamPortOne<T>>>>
 }
 
 impl<T> SharedPort<T> {
@@ -630,7 +630,7 @@ impl<T> SharedPort<T> {
         let (next_link_port, next_link_chan) = oneshot();
         next_link_chan.send(next_data_port);
         let next_link = AtomicOption::new(~next_link_port);
-        SharedPort { next_link: UnsafeAtomicRcBox::new(next_link) }
+        SharedPort { next_link: UnsafeArc::new(next_link) }
     }
 }
 
diff --git a/src/libstd/rt/kill.rs b/src/libstd/rt/kill.rs
index 94df621ce76..e6003fb1a44 100644
--- a/src/libstd/rt/kill.rs
+++ b/src/libstd/rt/kill.rs
@@ -159,7 +159,7 @@ use rt::task::Task;
 use task::spawn::Taskgroup;
 use to_bytes::IterBytes;
 use unstable::atomics::{AtomicUint, Relaxed};
-use unstable::sync::{UnsafeAtomicRcBox, LittleLock};
+use unstable::sync::{UnsafeArc, LittleLock};
 use util;
 
 static KILLED_MSG: &'static str = "killed by linked failure";
@@ -170,7 +170,7 @@ static KILL_KILLED:     uint = 1;
 static KILL_UNKILLABLE: uint = 2;
 
 struct KillFlag(AtomicUint);
-type KillFlagHandle = UnsafeAtomicRcBox<KillFlag>;
+type KillFlagHandle = UnsafeArc<KillFlag>;
 
 /// A handle to a blocked task. Usually this means having the ~Task pointer by
 /// ownership, but if the task is killable, a killer can steal it at any time.
@@ -211,7 +211,7 @@ struct KillHandleInner {
 
 /// State shared between tasks used for task killing during linked failure.
 #[deriving(Clone)]
-pub struct KillHandle(UnsafeAtomicRcBox<KillHandleInner>);
+pub struct KillHandle(UnsafeArc<KillHandleInner>);
 
 /// Per-task state related to task death, killing, failure, etc.
 pub struct Death {
@@ -317,7 +317,7 @@ impl BlockedTask {
         let handles = match self {
             Unkillable(task) => {
                 let flag = unsafe { KillFlag(AtomicUint::new(cast::transmute(task))) };
-                UnsafeAtomicRcBox::newN(flag, num_handles)
+                UnsafeArc::newN(flag, num_handles)
             }
             Killable(flag_arc) => flag_arc.cloneN(num_handles),
         };
@@ -380,8 +380,8 @@ impl Eq for KillHandle {
 impl KillHandle {
     pub fn new() -> (KillHandle, KillFlagHandle) {
         let (flag, flag_clone) =
-            UnsafeAtomicRcBox::new2(KillFlag(AtomicUint::new(KILL_RUNNING)));
-        let handle = KillHandle(UnsafeAtomicRcBox::new(KillHandleInner {
+            UnsafeArc::new2(KillFlag(AtomicUint::new(KILL_RUNNING)));
+        let handle = KillHandle(UnsafeArc::new(KillHandleInner {
             // Linked failure fields
             killed:     flag,
             unkillable: AtomicUint::new(KILL_RUNNING),
@@ -460,7 +460,7 @@ impl KillHandle {
     pub fn notify_immediate_failure(&mut self) {
         // A benign data race may happen here if there are failing sibling
         // tasks that were also spawned-watched. The refcount's write barriers
-        // in UnsafeAtomicRcBox ensure that this write will be seen by the
+        // in UnsafeArc ensure that this write will be seen by the
         // unwrapper/destructor, whichever task may unwrap it.
         unsafe { (*self.get()).any_child_failed = true; }
     }
diff --git a/src/libstd/rt/message_queue.rs b/src/libstd/rt/message_queue.rs
index 2bbcaff6d28..99b5156b319 100644
--- a/src/libstd/rt/message_queue.rs
+++ b/src/libstd/rt/message_queue.rs
@@ -16,11 +16,11 @@ use kinds::Send;
 use vec::OwnedVector;
 use cell::Cell;
 use option::*;
-use unstable::sync::{UnsafeAtomicRcBox, LittleLock};
+use unstable::sync::{UnsafeArc, LittleLock};
 use clone::Clone;
 
 pub struct MessageQueue<T> {
-    priv state: UnsafeAtomicRcBox<State<T>>
+    priv state: UnsafeArc<State<T>>
 }
 
 struct State<T> {
@@ -32,7 +32,7 @@ struct State<T> {
 impl<T: Send> MessageQueue<T> {
     pub fn new() -> MessageQueue<T> {
         MessageQueue {
-            state: UnsafeAtomicRcBox::new(State {
+            state: UnsafeArc::new(State {
                 count: 0,
                 queue: ~[],
                 lock: LittleLock::new()
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index 0d59d5780cc..7436efb5bf5 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -74,7 +74,7 @@ use rt::thread::Thread;
 use rt::work_queue::WorkQueue;
 use rt::uv::uvio::UvEventLoop;
 use unstable::atomics::{AtomicInt, SeqCst};
-use unstable::sync::UnsafeAtomicRcBox;
+use unstable::sync::UnsafeArc;
 use vec::{OwnedVector, MutableVector};
 
 /// The global (exchange) heap.
@@ -311,7 +311,7 @@ fn run_(main: ~fn(), use_main_sched: bool) -> int {
 
     // Create a shared cell for transmitting the process exit
     // code from the main task to this function.
-    let exit_code = UnsafeAtomicRcBox::new(AtomicInt::new(0));
+    let exit_code = UnsafeArc::new(AtomicInt::new(0));
     let exit_code_clone = exit_code.clone();
 
     // When the main task exits, after all the tasks in the main
diff --git a/src/libstd/rt/sleeper_list.rs b/src/libstd/rt/sleeper_list.rs
index 7232afd6594..f4fdf15cda6 100644
--- a/src/libstd/rt/sleeper_list.rs
+++ b/src/libstd/rt/sleeper_list.rs
@@ -15,12 +15,12 @@ use container::Container;
 use vec::OwnedVector;
 use option::{Option, Some, None};
 use cell::Cell;
-use unstable::sync::{UnsafeAtomicRcBox, LittleLock};
+use unstable::sync::{UnsafeArc, LittleLock};
 use rt::sched::SchedHandle;
 use clone::Clone;
 
 pub struct SleeperList {
-    priv state: UnsafeAtomicRcBox<State>
+    priv state: UnsafeArc<State>
 }
 
 struct State {
@@ -32,7 +32,7 @@ struct State {
 impl SleeperList {
     pub fn new() -> SleeperList {
         SleeperList {
-            state: UnsafeAtomicRcBox::new(State {
+            state: UnsafeArc::new(State {
                 count: 0,
                 stack: ~[],
                 lock: LittleLock::new()