about summary refs log tree commit diff
path: root/src/rt/rust_kernel.h
diff options
context:
space:
mode:
authorMichael Bebenita <mbebenita@mozilla.com>2010-09-08 15:16:14 -0700
committerMichael Bebenita <mbebenita@mozilla.com>2010-09-08 15:17:09 -0700
commit388f8ce520b16d73bf682cf6bf3f714bcc35b49d (patch)
treed8a6a1180ec715b8dd87239fb5e315149a40a078 /src/rt/rust_kernel.h
parent37cc13960744ad8a7a828da1db6edd4ced454353 (diff)
downloadrust-388f8ce520b16d73bf682cf6bf3f714bcc35b49d.tar.gz
rust-388f8ce520b16d73bf682cf6bf3f714bcc35b49d.zip
Cleaned up locking in the kernel.
Diffstat (limited to 'src/rt/rust_kernel.h')
-rw-r--r--src/rt/rust_kernel.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h
index 8c599c1f92d..db3ad0687eb 100644
--- a/src/rt/rust_kernel.h
+++ b/src/rt/rust_kernel.h
@@ -32,6 +32,12 @@ public:
     }
 };
 
+#define LOCK(x) x.lock();
+#define UNLOCK(x) x.unlock();
+
+#define PLOCK(x) printf("LOCKING @ %d\n", __LINE__); x.lock();
+#define PUNLOCK(x) x.unlock(); printf("UNLOCKED @ %d\n", __LINE__);
+
 /**
  * A global object shared by all thread domains. Most of the data structures
  * in this class are synchronized since they are accessed from multiple
@@ -55,20 +61,19 @@ class rust_kernel : public rust_thread {
     void start_kernel_loop();
     bool volatile _interrupt_kernel_loop;
 
-    /**
-     * Lock for the message queue list, so we can safely
-     */
-    spin_lock _message_queues_lock;
+    spin_lock _kernel_lock;
 
     void terminate_kernel_loop();
     void pump_message_queues();
 
+    rust_handle<rust_dom> *internal_get_dom_handle(rust_dom *dom);
+
 public:
 
     /**
      * List of domains that are currently executing.
      */
-    synchronized_indexed_list<rust_dom> domains;
+    indexed_list<rust_dom> domains;
 
     /**
      * Message queues are kernel objects and are associated with domains.
@@ -79,7 +84,7 @@ public:
      * Although the message_queues list is synchronized, each individual
      * message queue is lock free.
      */
-    synchronized_indexed_list<rust_message_queue> message_queues;
+    indexed_list<rust_message_queue> message_queues;
 
     rust_handle<rust_dom> *get_dom_handle(rust_dom *dom);
     rust_handle<rust_task> *get_task_handle(rust_task *task);