about summary refs log tree commit diff
path: root/src/rt/rust.cpp
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-07-23 19:03:02 -0700
committerEric Holk <eholk@mozilla.com>2011-07-28 10:47:28 -0700
commit62bc6b51136760b1d4f4b691aaa089bdb9bf0af5 (patch)
treebd4787e8bd4eed7b3ca7b3d99ece0fc75ae444fa /src/rt/rust.cpp
parentb51f5c395cc3458e428159b908ca95b1777e66e2 (diff)
downloadrust-62bc6b51136760b1d4f4b691aaa089bdb9bf0af5.tar.gz
rust-62bc6b51136760b1d4f4b691aaa089bdb9bf0af5.zip
Per-thread scheduling. Closes #682.
Tasks are spawned on a random thread. Currently they stay there, but
we should add task migration and load balancing in the future. This
should drammatically improve our task performance benchmarks.
Diffstat (limited to 'src/rt/rust.cpp')
-rw-r--r--src/rt/rust.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index 06097e34197..df1486952eb 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -140,9 +140,10 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
 
     update_log_settings(crate_map, getenv("RUST_LOG"));
     enable_claims(getenv("CHECK_CLAIMS"));
+    int num_threads = get_num_threads();
 
     rust_srv *srv = new rust_srv();
-    rust_kernel *kernel = new rust_kernel(srv);
+    rust_kernel *kernel = new rust_kernel(srv, num_threads);
     kernel->start();
     rust_task *root_task = kernel->create_task(NULL, "main");
     rust_scheduler *sched = root_task->sched;
@@ -158,11 +159,9 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
 
     root_task->start(main_fn, (uintptr_t)args->args);
 
-    int num_threads = get_num_threads();
-
     DLOG(sched, dom, "Using %d worker threads.", num_threads);
 
-    int ret = kernel->start_task_threads(num_threads);
+    int ret = kernel->start_task_threads();
     delete args;
     delete kernel;
     delete srv;