about summary refs log tree commit diff
path: root/src/libstd/rt/work_queue.rs
diff options
context:
space:
mode:
authorEric Reed <ereed@mozilla.com>2013-06-17 12:45:40 -0700
committerEric Reed <ereed@mozilla.com>2013-06-17 12:45:40 -0700
commit35f3fa6383b5ed278879bfe5c74a913b885a2d4f (patch)
treebe8ca61c0beccd0b4c5d1e486c5322c1181c49f5 /src/libstd/rt/work_queue.rs
parent33ae193a3c1a156e73bf6880366c9785dd4b7393 (diff)
parent319cf6e465f203c794d71800808c2bd60a1e7613 (diff)
downloadrust-35f3fa6383b5ed278879bfe5c74a913b885a2d4f.tar.gz
rust-35f3fa6383b5ed278879bfe5c74a913b885a2d4f.zip
Merge remote-tracking branch 'upstream/io' into io
Conflicts:
	src/libstd/rt/uvio.rs
Diffstat (limited to 'src/libstd/rt/work_queue.rs')
-rw-r--r--src/libstd/rt/work_queue.rs46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/libstd/rt/work_queue.rs b/src/libstd/rt/work_queue.rs
index e9eb663392b..cfffc55a58c 100644
--- a/src/libstd/rt/work_queue.rs
+++ b/src/libstd/rt/work_queue.rs
@@ -21,40 +21,48 @@ pub struct WorkQueue<T> {
     priv queue: ~Exclusive<~[T]>
 }
 
-pub impl<T: Owned> WorkQueue<T> {
-    fn new() -> WorkQueue<T> {
+impl<T: Owned> WorkQueue<T> {
+    pub fn new() -> WorkQueue<T> {
         WorkQueue {
             queue: ~exclusive(~[])
         }
     }
 
-    fn push(&mut self, value: T) {
-        let value = Cell(value);
-        self.queue.with(|q| q.unshift(value.take()) );
+    pub fn push(&mut self, value: T) {
+        unsafe {
+            let value = Cell::new(value);
+            self.queue.with(|q| q.unshift(value.take()) );
+        }
     }
 
-    fn pop(&mut self) -> Option<T> {
-        do self.queue.with |q| {
-            if !q.is_empty() {
-                Some(q.shift())
-            } else {
-                None
+    pub fn pop(&mut self) -> Option<T> {
+        unsafe {
+            do self.queue.with |q| {
+                if !q.is_empty() {
+                    Some(q.shift())
+                } else {
+                    None
+                }
             }
         }
     }
 
-    fn steal(&mut self) -> Option<T> {
-        do self.queue.with |q| {
-            if !q.is_empty() {
-                Some(q.pop())
-            } else {
-                None
+    pub fn steal(&mut self) -> Option<T> {
+        unsafe {
+            do self.queue.with |q| {
+                if !q.is_empty() {
+                    Some(q.pop())
+                } else {
+                    None
+                }
             }
         }
     }
 
-    fn is_empty(&self) -> bool {
-        self.queue.with_imm(|q| q.is_empty() )
+    pub fn is_empty(&self) -> bool {
+        unsafe {
+            self.queue.with_imm(|q| q.is_empty() )
+        }
     }
 }