about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-02-03 15:18:58 -0800
committerBrian Anderson <banderson@mozilla.com>2012-02-03 23:48:12 -0800
commit3d0e7a7af3eeee433dd942bca01e085d7d5866a7 (patch)
tree336be29bd2a6ee29be28bdd2e530d3225a2c249e
parent8d881967a2be96a38df3b4d70337568c3f3562b7 (diff)
downloadrust-3d0e7a7af3eeee433dd942bca01e085d7d5866a7.tar.gz
rust-3d0e7a7af3eeee433dd942bca01e085d7d5866a7.zip
rt: Add a field to rust_task to hold its scheduler
-rw-r--r--src/rt/rust_builtin.cpp2
-rw-r--r--src/rt/rust_task.cpp1
-rw-r--r--src/rt/rust_task.h2
3 files changed, 3 insertions, 2 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 8ac85c4ece7..bcc3e944711 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -417,7 +417,7 @@ start_task(rust_task_id id, fn_env_pair *f) {
 extern "C" CDECL int
 sched_threads() {
     rust_task *task = rust_task_thread::get_task();
-    return task->thread->sched->number_of_threads();
+    return task->sched->number_of_threads();
 }
 
 extern "C" CDECL rust_port*
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index 4612a4858d8..150ef1a18c1 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -233,6 +233,7 @@ rust_task::rust_task(rust_task_thread *thread, rust_task_list *state,
     ref_count(1),
     stk(NULL),
     runtime_sp(0),
+    sched(thread->sched),
     thread(thread),
     cache(NULL),
     kernel(thread->kernel),
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index 54b2a66d361..7e407b38200 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -72,10 +72,10 @@ rust_task : public kernel_owned<rust_task>, rust_cond
 
     RUST_ATOMIC_REFCOUNT();
 
-    // Fields known to the compiler.
     context ctx;
     stk_seg *stk;
     uintptr_t runtime_sp;      // Runtime sp while task running.
+    rust_scheduler *sched;
     rust_task_thread *thread;
     rust_crate_cache *cache;