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.
This commit is contained in:
Andrew Plaza
2017-04-25 14:40:23 -04:00
parent 7127e14b5d
commit 5ba02ca940

View File

@@ -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();
}