From 68e755b1c26db09cf8e121bbbea2075f6116e279 Mon Sep 17 00:00:00 2001 From: Philipp Brüschweiler Date: Fri, 14 Sep 2012 15:01:17 +0200 Subject: 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. --- src/rt/rust_builtin.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/rt/rust_builtin.cpp') 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(); -- cgit 1.4.1-3-g733a5