about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-07-25 18:07:20 -0700
committerBrian Anderson <banderson@mozilla.com>2011-07-29 21:03:17 -0700
commit9dbe6941c45571fb401719fa7b6a811a4ff0e80d (patch)
treec74f1ab0712119357eb78e09fee23578236f7d30
parentb8c209cba1038c64dea98d46b35b4bde30316dff (diff)
downloadrust-9dbe6941c45571fb401719fa7b6a811a4ff0e80d.tar.gz
rust-9dbe6941c45571fb401719fa7b6a811a4ff0e80d.zip
Add sched_threads rt function to get the number of scheduler threads
-rw-r--r--src/rt/rust_builtin.cpp5
-rw-r--r--src/rt/rust_kernel.h4
-rw-r--r--src/rt/rustrt.def.in1
3 files changed, 7 insertions, 3 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 6f45227bb8b..662ec3318d5 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -863,6 +863,11 @@ set_min_stack(rust_task *task, uintptr_t stack_size) {
     g_custom_min_stack_size = stack_size;
 }
 
+extern "C" CDECL int
+sched_threads(rust_task *task) {
+    return task->kernel->num_threads;
+}
+
 //
 // Local Variables:
 // mode: C++
diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h
index 66196e19684..45624765a8e 100644
--- a/src/rt/rust_kernel.h
+++ b/src/rt/rust_kernel.h
@@ -16,8 +16,6 @@ public:
 private:
     lock_and_signal _kernel_lock;
 
-    const size_t num_threads;
-
     array_list<rust_scheduler *> threads;
 
     randctx rctx;
@@ -30,10 +28,10 @@ private:
 
 public:
 
+    const size_t num_threads;
     int rval;
 
     volatile int live_tasks;
-
     struct rust_env *env;
 
     rust_kernel(rust_srv *srv, size_t num_threads);
diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in
index d6c218d936d..ffe2a822828 100644
--- a/src/rt/rustrt.def.in
+++ b/src/rt/rustrt.def.in
@@ -38,6 +38,7 @@ rust_run_program
 rust_start
 rust_getcwd
 set_min_stack
+sched_threads
 size_of
 squareroot
 str_alloc