Actually make bc timeout
Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
parent
9f10348b58
commit
b9c3674755
2 changed files with 4 additions and 2 deletions
2
bc.lua
2
bc.lua
|
|
@ -171,7 +171,7 @@ function BaseControl:finalize(waits, timeout)
|
||||||
if timeout ~= nil then
|
if timeout ~= nil then
|
||||||
timeout_remaining = timeout - (computer.uptime() - tstart)
|
timeout_remaining = timeout - (computer.uptime() - tstart)
|
||||||
if timeout_remaining <= 0 then
|
if timeout_remaining <= 0 then
|
||||||
break
|
error("timeout")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Wait until the next register arrives
|
-- Wait until the next register arrives
|
||||||
|
|
|
||||||
|
|
@ -50,5 +50,7 @@ end
|
||||||
function test_timeout_finalize()
|
function test_timeout_finalize()
|
||||||
local bc1 = BaseControl:new()
|
local bc1 = BaseControl:new()
|
||||||
local addr1 = network.get_scene()
|
local addr1 = network.get_scene()
|
||||||
bc1:finalize({"to_final1"}, 0.1)
|
assert_error_match("timeout", function()
|
||||||
|
bc1:finalize({"to_final1"}, 0.1)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue