Skip to content

Commit

Permalink
--amend
Browse files Browse the repository at this point in the history
  • Loading branch information
dbittman committed Nov 13, 2024
1 parent f1e6651 commit a64b805
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/kernel/src/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,16 @@ fn do_schedule(reinsert: bool) {

pub fn schedule(reinsert: bool) {
let cur = current_thread_ref().unwrap();
/* TODO: switch to needs to also drop the ref on cur, somehow... */
/* TODO: if we preempt, just put the thread back on our list (or decide to not resched) */
let istate = interrupt::disable();
if cur.is_critical() {
interrupt::set(istate);
return;
}
// We have to drop cur here and get it again later, after the call to do_schedule, even though
// it will be the same thread later. This is because the final call to this function after a
// thread exits will never return here after going into do_schedule, so we have to ensure
// that cur is dropped before then.
drop(cur);

do_schedule(reinsert);
Expand Down

0 comments on commit a64b805

Please sign in to comment.