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,15 +51,19 @@ if nixio.sysinfo().totalram < 32 * 1024 * 1024 then
|
||||||
end
|
end
|
||||||
|
|
||||||
function wait_for_ticks(ticks)
|
function wait_for_ticks(ticks)
|
||||||
local when = nixio.sysinfo().uptime + ticks
|
if ticks <= 0 then
|
||||||
while true
|
coroutine.yield(0)
|
||||||
do
|
else
|
||||||
if ticks >= 0 then
|
local when = nixio.sysinfo().uptime + ticks
|
||||||
coroutine.yield(ticks)
|
while true
|
||||||
else
|
do
|
||||||
break
|
if ticks > 0 then
|
||||||
|
coroutine.yield(ticks)
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
ticks = when - nixio.sysinfo().uptime
|
||||||
end
|
end
|
||||||
ticks = when - nixio.sysinfo().uptime
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue