about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-02-03 15:45:59 -0800
committerBrian Anderson <banderson@mozilla.com>2012-02-03 23:48:12 -0800
commite7f00b64933b85289921f641b2658f41eeb338ec (patch)
treefdd69132ccbbf691c5658639373636d27443dd09 /src
parentbf250bec7c59b52bbeb6bcb67d4b09133fd2f483 (diff)
downloadrust-e7f00b64933b85289921f641b2658f41eeb338ec.tar.gz
rust-e7f00b64933b85289921f641b2658f41eeb338ec.zip
rt: Do all task creation through a scheduler
Diffstat (limited to 'src')
-rw-r--r--src/rt/rust.cpp4
-rw-r--r--src/rt/rust_kernel.cpp16
-rw-r--r--src/rt/rust_kernel.h5
3 files changed, 10 insertions, 15 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index 9f9af2c5e8c..b5af3942a20 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -1,5 +1,6 @@
 #include "rust_internal.h"
 #include "rust_util.h"
+#include "rust_scheduler.h"
 #include <cstdio>
 
 struct
@@ -87,7 +88,8 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
 
     rust_srv *srv = new rust_srv(env);
     rust_kernel *kernel = new rust_kernel(srv, env->num_sched_threads);
-    rust_task_id root_id = kernel->create_task(NULL, "main", MAIN_STACK_SIZE);
+    rust_scheduler *sched = kernel->get_default_scheduler();
+    rust_task_id root_id = sched->create_task(NULL, "main", MAIN_STACK_SIZE);
     rust_task *root_task = kernel->get_task_by_id(root_id);
     I(kernel, root_task != NULL);
     rust_task_thread *thread = root_task->thread;
diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp
index c04a8d9d427..59175402246 100644
--- a/src/rt/rust_kernel.cpp
+++ b/src/rt/rust_kernel.cpp
@@ -65,6 +65,11 @@ int rust_kernel::start_schedulers()
     return rval;
 }
 
+rust_scheduler *
+rust_kernel::get_default_scheduler() {
+    return sched;
+}
+
 void
 rust_kernel::fail() {
     // FIXME: On windows we're getting "Application has requested the
@@ -77,17 +82,6 @@ rust_kernel::fail() {
     sched->kill_all_tasks();
 }
 
-rust_task_id
-rust_kernel::create_task(rust_task *spawner, const char *name,
-                         size_t init_stack_sz) {
-    return sched->create_task(spawner, name, init_stack_sz);
-}
-
-rust_task_id
-rust_kernel::create_task(rust_task *spawner, const char *name) {
-    return create_task(spawner, name, env->min_stack_size);
-}
-
 void
 rust_kernel::register_task(rust_task *task) {
     scoped_lock with(_kernel_lock);
diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h
index d6a1d0f19c2..17eaccdf879 100644
--- a/src/rt/rust_kernel.h
+++ b/src/rt/rust_kernel.h
@@ -47,17 +47,16 @@ public:
     void fail();
 
     int start_schedulers();
+    rust_scheduler* get_default_scheduler();
 
 #ifdef __WIN32__
     void win32_require(LPCTSTR fn, BOOL ok);
 #endif
 
-    rust_task_id create_task(rust_task *spawner, const char *name,
-			     size_t init_stack_size);
-    rust_task_id create_task(rust_task * spawner, const char *name);
     void register_task(rust_task *task);
     rust_task *get_task_by_id(rust_task_id id);
     void release_task_id(rust_task_id tid);
+
     void set_exit_status(int code);
 };