From 128b3ae03b6f0481ad7989d66c42fbabe5ffb2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Fri, 10 Jan 2014 17:31:10 +0100 Subject: [PATCH] running the debug hook that is used to check for timeouts more often, may help with #78 --- assets/opencomputers/lua/kernel.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/opencomputers/lua/kernel.lua b/assets/opencomputers/lua/kernel.lua index d59e97f93..9883d08e3 100644 --- a/assets/opencomputers/lua/kernel.lua +++ b/assets/opencomputers/lua/kernel.lua @@ -1,3 +1,4 @@ +local hookInterval = 100 local deadline = 0 local function checkDeadline() if computer.realTime() > deadline then @@ -94,7 +95,7 @@ sandbox = { checkArg(1, co, "thread") local args = table.pack(...) while true do -- for consecutive sysyields - debug.sethook(co, checkDeadline, "", 10000) + debug.sethook(co, checkDeadline, "", hookInterval) local result = table.pack( coroutine.resume(co, table.unpack(args, 1, args.n))) debug.sethook(co) -- avoid gc issues @@ -396,7 +397,7 @@ local function main() local co, args = bootstrap(), {n=0} while true do deadline = computer.realTime() + timeout -- timeout global is set by host - debug.sethook(co, checkDeadline, "", 10000) + debug.sethook(co, checkDeadline, "", hookInterval) local result = table.pack(coroutine.resume(co, table.unpack(args, 1, args.n))) if not result[1] then error(tostring(result[2]), 0)