We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1046976 commit 49c982dCopy full SHA for 49c982d
os/src/task/mod.rs
@@ -131,8 +131,13 @@ pub fn exit_current_and_run_next(exit_code: i32) {
131
process_inner.memory_set.recycle_data_pages();
132
// drop file descriptors
133
process_inner.fd_table.clear();
134
- // remove all tasks
135
- process_inner.tasks.clear();
+ // Remove all tasks except for the main thread itself.
+ // This is because we are still using the kstack under the TCB
136
+ // of the main thread. This TCB, including its kstack, will be
137
+ // deallocated when the process is reaped via waitpid.
138
+ while process_inner.tasks.len() > 1 {
139
+ process_inner.tasks.pop();
140
+ }
141
}
142
drop(process);
143
// we do not have to save task context
0 commit comments