Fixed nobody to run
This commit is contained in:
parent
5f8965b94d
commit
8c61fd1aa6
@ -239,7 +239,11 @@ impl ThreadManager {
|
|||||||
while next_thread.is_none() {
|
while next_thread.is_none() {
|
||||||
eprintln!("Nobody to run => idle");
|
eprintln!("Nobody to run => idle");
|
||||||
machine.interrupt.idle();
|
machine.interrupt.idle();
|
||||||
next_thread = self.find_next_to_run();
|
if let Some(t) = self.find_next_to_run() {
|
||||||
|
next_thread = Some(t);
|
||||||
|
} else {
|
||||||
|
panic!("Couldn't find next thread to run.\nShutting down...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.switch_to(machine, Rc::clone(&next_thread.unwrap()));
|
self.switch_to(machine, Rc::clone(&next_thread.unwrap()));
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
int main() {
|
int main() {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 1;
|
int y = 1;
|
||||||
while (x <= y) {
|
|
||||||
if (x > y) {
|
if (x > y) {
|
||||||
x += 1;
|
x += 1;
|
||||||
} else if (x == y) {
|
}
|
||||||
|
if (x == y) {
|
||||||
x += y;
|
x += y;
|
||||||
} else if (x < y) {
|
}
|
||||||
|
if (x < y) {
|
||||||
y += 1;
|
y += 1;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user