Is there a way to let Python (3) sleep (or do something else) until something happens and than call a function. I've read on wikipedia what interrupts are but can't seem to find how to implement them in Python(3). Isn't there something like this in Python:
Code:
until <mystatement>:
<mycode>
<the code that executes after something happens>
for example:
Code:
until a == 10:
sleep()
print("An event occured!")
or something like this:
Code:
sleep(until <a_signal>)
on <a_signal> do:
<mycode>
Using a loop and if statements (or only a while loop) causes a very high CPU usage, which of course is completely unnecessary because the program doesn't have to do anything.
Bookmarks