about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-04-06 17:03:00 -0700
committerBrian Anderson <banderson@mozilla.com>2012-04-07 19:56:41 -0700
commit01dc4a8b26d722d306a00e44a5b1ed5cf3fd24b1 (patch)
tree7bebe6c918cd108943cd8d07b0203b25256d063f /src/rt/rust_builtin.cpp
parenta6e748a1d9795f59f9ca954dbf1ad82d238c3990 (diff)
downloadrust-01dc4a8b26d722d306a00e44a5b1ed5cf3fd24b1.tar.gz
rust-01dc4a8b26d722d306a00e44a5b1ed5cf3fd24b1.zip
core: Add priv::weaken_task
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 910331fa7c0..f2714c4d7c3 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -669,22 +669,9 @@ get_port_id(rust_port *port) {
 }
 
 extern "C" CDECL uintptr_t
-rust_port_id_send(type_desc *t, rust_port_id target_port_id, void *sptr) {
-    bool sent = false;
+rust_port_id_send(rust_port_id target_port_id, void *sptr) {
     rust_task *task = rust_get_current_task();
-
-    LOG(task, comm, "rust_port_id*_send port: 0x%" PRIxPTR,
-        (uintptr_t) target_port_id);
-
-    rust_port *port = task->kernel->get_port_by_id(target_port_id);
-    if(port) {
-        port->send(sptr);
-        port->deref();
-        sent = true;
-    } else {
-        LOG(task, comm, "didn't get the port");
-    }
-    return (uintptr_t)sent;
+    return (uintptr_t)task->kernel->send_to_port(target_port_id, sptr);
 }
 
 // This is called by an intrinsic on the Rust stack and must run
@@ -782,6 +769,18 @@ rust_compare_and_swap_ptr(intptr_t *address,
     return sync::compare_and_swap(address, oldval, newval);
 }
 
+extern "C" CDECL void
+rust_task_weaken(rust_port_id chan) {
+    rust_task *task = rust_get_current_task();
+    task->kernel->weaken_task(chan);
+}
+
+extern "C" CDECL void
+rust_task_unweaken(rust_port_id chan) {
+    rust_task *task = rust_get_current_task();
+    task->kernel->unweaken_task(chan);
+}
+
 //
 // Local Variables:
 // mode: C++