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.
This commit is contained in:
Philipp Brüschweiler
2012-09-14 15:01:17 +02:00
committed by Brian Anderson
parent 35a9353774
commit 68e755b1c2
8 changed files with 102 additions and 48 deletions

View File

@@ -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();