about summary refs log tree commit diff
path: root/src/lib
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-08-02 12:29:10 -0700
committerEric Holk <eholk@mozilla.com>2011-08-05 15:27:27 -0700
commit200bbcf91b4eb190cff227127cc60a333f9c33a2 (patch)
tree0206d2c26a18af0dcb58bc5a9c5fded7108c11ba /src/lib
parent244efa6331eab49fa1bf765bfd6974d512ed6719 (diff)
downloadrust-200bbcf91b4eb190cff227127cc60a333f9c33a2.tar.gz
rust-200bbcf91b4eb190cff227127cc60a333f9c33a2.zip
Rewrote receive to return a value. This lets us initialize variables by receiving them.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/comm.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/comm.rs b/src/lib/comm.rs
index 1665626432a..35c8ad2f6ef 100644
--- a/src/lib/comm.rs
+++ b/src/lib/comm.rs
@@ -20,7 +20,10 @@ native "rust" mod rustrt {
     fn new_port(unit_sz : uint) -> *rust_port;
     fn del_port(po : *rust_port);
     fn drop_port(po : *rust_port);
-    fn port_recv(dp : *void, po : *rust_port);
+}
+
+native "rust-intrinsic" mod rusti {
+    fn recv[T](port : *rustrt::rust_port) -> T;
 }
 
 resource chan_ptr(ch: *rustrt::rust_chan) {
@@ -47,9 +50,8 @@ obj _port[T](raw_port : @port_ptr) {
         _chan(@chan_ptr(rustrt::new_chan(**raw_port)))
     }
 
-    fn recv_into(v : &T) {
-        rustrt::port_recv(unsafe::reinterpret_cast(ptr::addr_of(v)),
-                          **raw_port);
+    fn recv() -> T {
+        ret rusti::recv(**raw_port)
     }
 }