rt: Shutdown gracefully on failure
When the kernel fails, kill all tasks and wait for the schedulers to stop instead of just exiting. I'm sure there are tons of lurking issues here but this is enough to fail without leaking (at least in the absence of cleanups).
This commit is contained in:
@@ -134,6 +134,14 @@ int rust_kernel::start_task_threads()
|
||||
return rval;
|
||||
}
|
||||
|
||||
void
|
||||
rust_kernel::fail() {
|
||||
for(size_t i = 0; i < num_threads; ++i) {
|
||||
rust_scheduler *thread = threads[i];
|
||||
thread->kill_all_tasks();
|
||||
}
|
||||
}
|
||||
|
||||
rust_task_id
|
||||
rust_kernel::create_task(rust_task *spawner, const char *name) {
|
||||
rust_scheduler *thread = threads[rand(&rctx) % num_threads];
|
||||
|
||||
Reference in New Issue
Block a user