diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-05-07 14:32:36 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-05-07 14:32:36 -0700 |
| commit | f717100fc7b2db7ba10cebbf168f38a856a9425b (patch) | |
| tree | b7df37ce398962c07c6db12e3ee12ee6ec71b804 /src/rt/rust_kernel.cpp | |
| parent | 1db88e793756f691dd5b186b470117104a659883 (diff) | |
| download | rust-f717100fc7b2db7ba10cebbf168f38a856a9425b.tar.gz rust-f717100fc7b2db7ba10cebbf168f38a856a9425b.zip | |
rt: Start tasks, ports and scheds at 1, assert when we see 0. Closes #2321
Diffstat (limited to 'src/rt/rust_kernel.cpp')
| -rw-r--r-- | src/rt/rust_kernel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp index 44c6be2421d..4451f362f27 100644 --- a/src/rt/rust_kernel.cpp +++ b/src/rt/rust_kernel.cpp @@ -15,10 +15,10 @@ rust_kernel::rust_kernel(rust_env *env) : _region(env, true), _log(NULL), - max_task_id(0), - max_port_id(0), + max_task_id(1), + max_port_id(1), rval(0), - max_sched_id(0), + max_sched_id(1), sched_reaper(this), osmain_driver(NULL), non_weak_tasks(0), @@ -116,6 +116,7 @@ rust_kernel::get_scheduler_by_id(rust_sched_id id) { rust_scheduler * rust_kernel::get_scheduler_by_id_nolock(rust_sched_id id) { + assert(id != 0 && "invalid scheduler id"); sched_lock.must_have_lock(); sched_map::iterator iter = sched_table.find(id); if (iter != sched_table.end()) { @@ -250,6 +251,7 @@ rust_kernel::release_port_id(rust_port_id id) { rust_port * rust_kernel::get_port_by_id(rust_port_id id) { + assert(id != 0 && "invalid port id"); scoped_lock with(port_lock); rust_port *port = NULL; // get leaves port unchanged if not found. |
