mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
running the debug hook that is used to check for timeouts more often, may help with #78
This commit is contained in:
parent
27102a8be1
commit
128b3ae03b
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user