Page 1 of 1

Why is there sleep(0.001) in default love.run()?

Posted: Tue Jan 08, 2013 11:16 pm
by fuxoft
Why is there the following line in the default love.run() function?

Code: Select all

if love.timer then love.timer.sleep(0.001) end
Is it just a failsafe to prevent the 100% CPU load when someone pumps new frames without vsync, as fast as possible? Or does it have more complex purpose?

Re: Why is there sleep(0.001) in default love.run()?

Posted: Tue Jan 08, 2013 11:46 pm
by Lafolie

Re: Why is there sleep(0.001) in default love.run()?

Posted: Wed Jan 09, 2013 9:36 am
by Boolsheet
fuxoft wrote:Is it just a failsafe to prevent the 100% CPU load when someone pumps new frames without vsync, as fast as possible?
Yes, that's it. A very simple way to prevent LÖVE from wasting all the CPU cycles and it's in love.run so lovers can easily remove it, if they want to.