A similar solution is required fro your second loop - put a sleep in it. As it stands the loop will run just as fast as it can output stuff with print. That will be slower than an empty loop, but still pretty fast.
Another issue is that there is no way of stopping the 'alarm' loop. At the very least you should replace the while (1) with a down counter so it stops by itself eventually.
In reply to Re^3: Wakeup: event-loop system
by GrandFather
in thread Wakeup: event-loop system
by fernandes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |