about summary refs log tree commit diff
path: root/src/rt/rust_kernel.h
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-03-14 17:24:19 -0700
committerBrian Anderson <banderson@mozilla.com>2012-03-15 11:10:52 -0700
commitb278d675a231fdfe825c72e499d59e8a3d07ffaa (patch)
tree426a39a89561d56ac72e328aecc64c045a578e18 /src/rt/rust_kernel.h
parent337d860a8777a761267daaad9b561787b10e7c87 (diff)
downloadrust-b278d675a231fdfe825c72e499d59e8a3d07ffaa.tar.gz
rust-b278d675a231fdfe825c72e499d59e8a3d07ffaa.zip
rt: Look up ports through a single port table
Instead of a two-level lookup, just use one big table
Diffstat (limited to 'src/rt/rust_kernel.h')
-rw-r--r--src/rt/rust_kernel.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h
index 626e73f63d0..26938ec565b 100644
--- a/src/rt/rust_kernel.h
+++ b/src/rt/rust_kernel.h
@@ -30,6 +30,12 @@ private:
     rust_task_id max_task_id;
     hash_map<rust_task_id, rust_task *> task_table;
 
+    // Protects max_port_id and port_table
+    lock_and_signal port_lock;
+    // The next port id
+    rust_task_id max_port_id;
+    hash_map<rust_port_id, rust_port *> port_table;
+
     lock_and_signal rval_lock;
     int rval;
 
@@ -73,6 +79,10 @@ public:
     rust_task *get_task_by_id(rust_task_id id);
     void release_task_id(rust_task_id tid);
 
+    rust_port_id register_port(rust_port *port);
+    rust_port *get_port_by_id(rust_port_id id);
+    void release_port_id(rust_port_id tid);
+
     void set_exit_status(int code);
 };