about summary refs log tree commit diff
path: root/src/rt/rust_chan.cpp
diff options
context:
space:
mode:
authorunknown <Eric@.(none)>2011-08-08 13:38:20 -0700
committerEric Holk <eholk@mozilla.com>2011-08-08 16:55:38 -0700
commit44bef5f2cb175769155d92ec65bd6b16e6708a1e (patch)
treed7524b51e2af0cb191cd93cda3f282ac4ac8f4c6 /src/rt/rust_chan.cpp
parentf4f057ced1f4152575571a6e5116e1ad5bb38beb (diff)
downloadrust-44bef5f2cb175769155d92ec65bd6b16e6708a1e.tar.gz
rust-44bef5f2cb175769155d92ec65bd6b16e6708a1e.zip
Introduced task handles.
This is the new way to refer to tasks in rust-land. Currently all they
do is serve as a key to look up the old rust_task structure. Ideally
they won't be ref counted, but baby steps.
Diffstat (limited to 'src/rt/rust_chan.cpp')
-rw-r--r--src/rt/rust_chan.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rt/rust_chan.cpp b/src/rt/rust_chan.cpp
index 045694eee61..12a199f685d 100644
--- a/src/rt/rust_chan.cpp
+++ b/src/rt/rust_chan.cpp
@@ -73,16 +73,17 @@ void rust_chan::disassociate() {
  * Attempt to send data to the associated port.
  */
 void rust_chan::send(void *sptr) {
-    scoped_lock with(port->lock);
-
-    buffer.enqueue(sptr);
-
     if (!is_associated()) {
         W(kernel, is_associated(),
           "rust_chan::transmit with no associated port.");
         return;
     }
 
+    I(kernel, port != NULL);
+    scoped_lock with(port->lock);
+
+    buffer.enqueue(sptr);
+
     A(kernel, !buffer.is_empty(),
       "rust_chan::transmit with nothing to send.");