Not hard crashing when error is encountered

This commit is contained in:
Ryan Ward 2023-08-03 23:22:01 -04:00
parent 5359be0772
commit d50c187710
3 changed files with 22 additions and 33 deletions

View File

@ -2392,8 +2392,8 @@ function multi.error(self, err)
end end
if multi.defaultSettings.error then if multi.defaultSettings.error then
error("^^^ " .. multi:getCurrentProcess():getFullName() .. " " .. multi:getCurrentTask().Type .. "\n" .. debug.traceback().."\n") error("^^^ " .. multi:getCurrentProcess():getFullName() .. " " .. multi:getCurrentTask().Type .. "\n" .. debug.traceback().."\n")
os.exit(1)
end end
os.exit(1)
end end
function multi.success(...) function multi.success(...)

View File

@ -52,9 +52,6 @@ function multi:newProxy(list)
c.is_init = false c.is_init = false
local multi, thread = nil, nil local multi, thread = nil, nil
function c:init() function c:init()
for i,v in pairs(self) do
print("Pattern",i,v)
end
local multi, thread = nil, nil local multi, thread = nil, nil
local function copy(obj) local function copy(obj)
if type(obj) ~= 'table' then return obj end if type(obj) ~= 'table' then return obj end
@ -172,7 +169,6 @@ function multi:newProxy(list)
return self return self
end end
end end
function c:getTransferable() function c:getTransferable()
local cp = {} local cp = {}
local multi, thread = require("multi"):init() local multi, thread = require("multi"):init()
@ -197,12 +193,8 @@ function multi:newProxy(list)
proxy.funcs = self.funcs proxy.funcs = self.funcs
return proxy:init() return proxy:init()
end end
for i,v in pairs(cp) do
print("TRANS", i, v)
end
return cp return cp
end end
self:create(c) self:create(c)
return c return c
end end

View File

@ -55,9 +55,6 @@ multi:newThread("Scheduler Thread",function()
multi_assert("Passing some args", a, "First argument is not as expected 'Passing some args'") multi_assert("Passing some args", a, "First argument is not as expected 'Passing some args'")
multi_assert(true, e, "Argument e is not true!") multi_assert(true, e, "Argument e is not true!")
multi_assert("table", type(f), "Argument f is not a table!") multi_assert("table", type(f), "Argument f is not a table!")
for i,v in pairs(queue) do
print("Queue:",i,v)
end
queue:push("done") queue:push("done")
end,"Passing some args", 1, 2, 3, true, {"Table"}).OnError(function(self,err) end,"Passing some args", 1, 2, 3, true, {"Table"}).OnError(function(self,err)
multi.error(err) multi.error(err)
@ -195,25 +192,25 @@ multi:newThread("Scheduler Thread",function()
local tloop = stp:newTLoop(nil, 1) local tloop = stp:newTLoop(nil, 1)
-- multi:newSystemThread("Testing proxy copy THREAD",function(tloop) multi:newSystemThread("Testing proxy copy THREAD",function(tloop)
-- local multi, thread = require("multi"):init() local multi, thread = require("multi"):init()
-- for i,v in pairs(tloop.funcs) do for i,v in pairs(tloop.funcs) do
-- print(i,v) print(i,v)
-- end end
-- tloop = tloop:init() tloop = tloop:init()
-- multi.print("tloop type:",tloop.Type) multi.print("tloop type:",tloop.Type)
-- multi.print("Testing proxies on other threads") multi.print("Testing proxies on other threads")
-- thread:newThread(function() thread:newThread(function()
-- while true do while true do
-- thread.hold(tloop.OnLoop) thread.hold(tloop.OnLoop)
-- print(THREAD_NAME,"Loopy") print(THREAD_NAME,"Loopy")
-- end end
-- end) end)
-- tloop.OnLoop(function(a) tloop.OnLoop(function(a)
-- print(THREAD_NAME, "Got loop...") print(THREAD_NAME, "Got loop...")
-- end) end)
-- multi:mainloop() multi:mainloop()
-- end, tloop:getTransferable()).OnError(multi.error) end, tloop:getTransferable()).OnError(multi.error)
multi.print("tloop", tloop.Type) multi.print("tloop", tloop.Type)
multi.print("tloop.OnLoop", tloop.OnLoop.Type) multi.print("tloop.OnLoop", tloop.OnLoop.Type)
@ -240,8 +237,8 @@ multi:newThread("Scheduler Thread",function()
end) end)
t, val = thread.hold(function() t, val = thread.hold(function()
return proxy_test return count == 10
end,{sleep=15}) end,{sleep=5})
if val == multi.TIMEOUT then if val == multi.TIMEOUT then
multi.error("SystemThreadedProcessor/Proxies: Failed") multi.error("SystemThreadedProcessor/Proxies: Failed")