mirror of https://github.com/aredn/aredn.git
Fix busy wait when tick == 0 (#1206)
This commit is contained in:
parent
b495f4e62b
commit
250db5605f
|
@ -51,10 +51,13 @@ if nixio.sysinfo().totalram < 32 * 1024 * 1024 then
|
||||||
end
|
end
|
||||||
|
|
||||||
function wait_for_ticks(ticks)
|
function wait_for_ticks(ticks)
|
||||||
|
if ticks <= 0 then
|
||||||
|
coroutine.yield(0)
|
||||||
|
else
|
||||||
local when = nixio.sysinfo().uptime + ticks
|
local when = nixio.sysinfo().uptime + ticks
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
if ticks >= 0 then
|
if ticks > 0 then
|
||||||
coroutine.yield(ticks)
|
coroutine.yield(ticks)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
|
@ -62,6 +65,7 @@ function wait_for_ticks(ticks)
|
||||||
ticks = when - nixio.sysinfo().uptime
|
ticks = when - nixio.sysinfo().uptime
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function exit_app()
|
function exit_app()
|
||||||
coroutine.yield('exit')
|
coroutine.yield('exit')
|
||||||
|
|
Loading…
Reference in New Issue