about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorPhilipp Brüschweiler <blei42@gmail.com>2012-09-14 15:01:17 +0200
committerBrian Anderson <banderson@mozilla.com>2012-09-19 14:01:53 -0700
commit68e755b1c26db09cf8e121bbbea2075f6116e279 (patch)
tree8d48dc089bb9effd2090117fd6033c4ca81470d1 /src/rt/rust_builtin.cpp
parent35a935377483823ca1fbaede5a87406b494b0488 (diff)
downloadrust-68e755b1c26db09cf8e121bbbea2075f6116e279.tar.gz
rust-68e755b1c26db09cf8e121bbbea2075f6116e279.zip
core: Allocate threads on demand, not on scheduler startup
API change: rust_kernel::create_scheduler() or
rust_scheduler::rust_scheduler() respecitevly now take ownership of the
launch factory argument, it is needed to create new threads on demand.

Also renames rustrt::sched_threads() to rustrt::rust_sched_threads() for
consistency. Added rustrt::rust_max_sched_threads() to return the
maximal number of scheduled threads of the current scheduler.

Fixes #3493.
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index a601908359c..f1c2afc0f4b 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -627,11 +627,17 @@ start_task(rust_task *target, fn_env_pair *f) {
 }
 
 extern "C" CDECL size_t
-sched_threads() {
+rust_sched_threads() {
     rust_task *task = rust_get_current_task();
     return task->sched->number_of_threads();
 }
 
+extern "C" CDECL size_t
+rust_max_sched_threads() {
+    rust_task *task = rust_get_current_task();
+    return task->sched->max_number_of_threads();
+}
+
 extern "C" CDECL rust_port*
 rust_port_take(rust_port_id id) {
     rust_task *task = rust_get_current_task();