Obviously, there is a situation when we can't use Timer to delay execution of a code. One example in my mind is coding in XojoScript.
Assuming, we have this code
while true // some code here delay(1000) // delay 1000ms wend
Here, we have 2 solutions for delay function,
- Wrap the code inside a Thread and call
However, both solutions will cause high CPU usage.
Does anybody have other efficient solutions?