about summary refs log tree commit diff
path: root/src/rt/rust.cpp
diff options
context:
space:
mode:
authorMichael Bebenita <mbebenita@mozilla.com>2010-07-19 14:05:18 -0700
committerMichael Bebenita <mbebenita@mozilla.com>2010-07-19 14:05:18 -0700
commit00d1465d13980fc3acf650f182ee0723fbda0e06 (patch)
treea73cf5f0f20c0bee6722b33d975eb930919fefdf /src/rt/rust.cpp
parent1f0656d9084970fcc02ba9c27277265b8b3b7217 (diff)
downloadrust-00d1465d13980fc3acf650f182ee0723fbda0e06.tar.gz
rust-00d1465d13980fc3acf650f182ee0723fbda0e06.zip
Added a message passing system based on lock free queues for inter-thread communication. Channels now buffer on the sending side, and no longer require blocking when sending. Lots of other refactoring and bug fixes.
Diffstat (limited to 'src/rt/rust.cpp')
-rw-r--r--src/rt/rust.cpp49
1 files changed, 1 insertions, 48 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index 235eb8d0d98..00e709c9748 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -1,7 +1,6 @@
 #include "rust_internal.h"
 #include "util/array_list.h"
 
-
 // #define TRACK_ALLOCATIONS
 // For debugging, keeps track of live allocations, so you can find out
 // exactly what leaked.
@@ -100,52 +99,6 @@ rust_srv::clone()
     return new rust_srv();
 }
 
-
-int
-rust_main_loop(rust_dom *dom)
-{
-    // Make sure someone is watching, to pull us out of infinite loops.
-    rust_timer timer(*dom);
-
-    int rval;
-    rust_task *task;
-
-    dom->log(rust_log::DOM,
-            "running main-loop on domain 0x%" PRIxPTR, dom);
-    dom->logptr("exit-task glue",
-            dom->root_crate->get_exit_task_glue());
-
-    while ((task = dom->sched()) != NULL) {
-        I(dom, task->running());
-
-        dom->log(rust_log::TASK,
-                "activating task 0x%" PRIxPTR ", sp=0x%" PRIxPTR,
-                (uintptr_t)task, task->rust_sp);
-
-        dom->interrupt_flag = 0;
-
-        dom->activate(task);
-
-        dom->log(rust_log::TASK,
-                 "returned from task 0x%" PRIxPTR
-                 " in state '%s', sp=0x%" PRIxPTR,
-                 (uintptr_t)task,
-                 dom->state_vec_name(task->state),
-                 task->rust_sp);
-
-        I(dom, task->rust_sp >= (uintptr_t) &task->stk->data[0]);
-        I(dom, task->rust_sp < task->stk->limit);
-
-        dom->reap_dead_tasks();
-    }
-
-    dom->log(rust_log::DOM, "finished main-loop (dom.rval = %d)", dom->rval);
-    rval = dom->rval;
-
-    return rval;
-}
-
-
 struct
 command_line_args
 {
@@ -243,7 +196,7 @@ rust_start(uintptr_t main_fn, rust_crate const *crate, int argc, char **argv)
                              (uintptr_t)&main_args,
                              sizeof(main_args));
 
-        ret = rust_main_loop(&dom);
+        ret = dom.start_main_loop();
     }
 
 #if !defined(__WIN32__)