clarify (and improve) how WAIT works
This commit is contained in:
parent
6182fafe06
commit
dbe374b4bf
1 changed files with 3 additions and 4 deletions
|
@ -146,11 +146,10 @@ class InterruptManager:
|
||||||
return InterruptTrap(irq.pri, irq.vector)
|
return InterruptTrap(irq.pri, irq.vector)
|
||||||
|
|
||||||
def waitstate(self, processor_pri):
|
def waitstate(self, processor_pri):
|
||||||
"""Sit idle until any interrupt happens."""
|
"""Sit idle until an interrupt of sufficient priority happens."""
|
||||||
with self.condition:
|
with self.condition:
|
||||||
if self.pri_pending > processor_pri:
|
while self.pri_pending <= processor_pri:
|
||||||
return
|
self.condition.wait()
|
||||||
self.condition.wait_for(lambda: self.pri_pending)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Reference in a new issue