From b278d675a231fdfe825c72e499d59e8a3d07ffaa Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 14 Mar 2012 17:24:19 -0700 Subject: rt: Look up ports through a single port table Instead of a two-level lookup, just use one big table --- src/rt/rust_builtin.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/rt/rust_builtin.cpp') diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 9f2bb2d4652..de782c355c3 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -513,7 +513,6 @@ get_port_id(rust_port *port) { extern "C" CDECL uintptr_t chan_id_send(type_desc *t, rust_task_id target_task_id, rust_port_id target_port_id, void *sptr) { - // FIXME: make sure this is thread-safe bool sent = false; rust_task *task = rust_task_thread::get_task(); @@ -521,19 +520,13 @@ chan_id_send(type_desc *t, rust_task_id target_task_id, " port: 0x%" PRIxPTR, (uintptr_t) target_task_id, (uintptr_t) target_port_id); - rust_task *target_task = task->kernel->get_task_by_id(target_task_id); - if(target_task) { - rust_port *port = target_task->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"); - } - target_task->deref(); + 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 task"); + LOG(task, comm, "didn't get the port"); } return (uintptr_t)sent; } -- cgit 1.4.1-3-g733a5