about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-03-03 02:50:23 -0800
committerBrian Anderson <banderson@mozilla.com>2012-03-05 19:39:56 -0800
commit8e0efce0dad2a63fd290918df38a1d7626e6d4b3 (patch)
tree7d375e0bf7a2bcb26b907c2a8099b14ea8d2450c
parent93fa933a1926f953fa74b9b4908c0e6dc9b0a964 (diff)
downloadrust-8e0efce0dad2a63fd290918df38a1d7626e6d4b3.tar.gz
rust-8e0efce0dad2a63fd290918df38a1d7626e6d4b3.zip
rt: Move some code from rust_port_detach into rust_port::detach
-rw-r--r--src/rt/rust_builtin.cpp6
-rw-r--r--src/rt/rust_port.cpp6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index dcf01e4420e..17c958633d1 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -486,12 +486,6 @@ rust_port_detach(rust_port *port) {
     rust_task *task = rust_task_thread::get_task();
     LOG(task, comm, "rust_port_detach(0x%" PRIxPTR ")", (uintptr_t) port);
     port->detach();
-    // FIXME: Busy waiting until we're the only ref
-    bool done = false;
-    while (!done) {
-        scoped_lock with(task->port_lock);
-        done = port->ref_count == 1;
-    }
 }
 
 extern "C" CDECL void
diff --git a/src/rt/rust_port.cpp b/src/rt/rust_port.cpp
index 46e18ba1acb..f4843971e42 100644
--- a/src/rt/rust_port.cpp
+++ b/src/rt/rust_port.cpp
@@ -22,6 +22,12 @@ rust_port::~rust_port() {
 
 void rust_port::detach() {
     task->release_port(id);
+    // FIXME: Busy waiting until we're the only ref
+    bool done = false;
+    while (!done) {
+        scoped_lock with(task->port_lock);
+        done = ref_count == 1;
+    }
 }
 
 void rust_port::send(void *sptr) {