Reset PIT_TICKS to 0 on context::switch, change condition for context::switch [irq]
Set the counter to 0 when context is to be switched in the PIT interrupt,
and change the condition for context switching from % 10 to >= 10.
@@ -51,7 +51,9 @@ interrupt!(pit, {
pic::MASTER.ack();
- if PIT_TICKS.fetch_add(1, Ordering::SeqCst) % 10 == 0 {
+ if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 10 {
+ PIT_TICKS.store(0, Ordering::SeqCst);
+ assert_eq!(PIT_TICKS.load(Ordering::SeqCst), 0);
context::switch();
}
