about summary refs log tree commit diff
path: root/src/lib/task.rs
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-07-21 12:11:05 -0700
committerEric Holk <eholk@mozilla.com>2011-07-22 18:45:34 -0700
commit8878b128baddfa4ee38e4f9c43be75abe0edcd3d (patch)
treeaa36c8323cffd2cff75f39a26131137300b03555 /src/lib/task.rs
parent8f2254b8c28c17bf7346975205b623ee92ba947c (diff)
downloadrust-8878b128baddfa4ee38e4f9c43be75abe0edcd3d.tar.gz
rust-8878b128baddfa4ee38e4f9c43be75abe0edcd3d.zip
More work on word-count.
Updated the MapReduce protocol so that it's correct more often. It's
still not perfect, but the bugs repro less often now.

Also found a race condition in channel sending. The problem is that
send and receive both need to refer to the _unread field in
circular_buffer. For now I just grabbed the port lock to send. We can
probably get around this by using atomics instead.
Diffstat (limited to 'src/lib/task.rs')
-rw-r--r--src/lib/task.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/task.rs b/src/lib/task.rs
index c26fa632997..27b9e4030a0 100644
--- a/src/lib/task.rs
+++ b/src/lib/task.rs
@@ -5,6 +5,9 @@ native "rust" mod rustrt {
     fn unsupervise();
     fn pin_task();
     fn unpin_task();
+    fn clone_chan(*rust_chan c) -> *rust_chan;
+
+    type rust_chan;
 }
 
 /**
@@ -44,6 +47,11 @@ fn unpin() {
     rustrt::unpin_task();
 }
 
+fn clone_chan[T](chan[T] c) -> chan[T] {
+    auto cloned = rustrt::clone_chan(unsafe::reinterpret_cast(c));
+    ret unsafe::reinterpret_cast(cloned);
+}
+
 // Local Variables:
 // mode: rust;
 // fill-column: 78;