Debugging what is going on...

This commit is contained in:
Ryan Ward 2023-06-19 00:24:07 -04:00
parent 1b3e3303e9
commit c80f44c68e
5 changed files with 21 additions and 15 deletions

View File

@ -1113,7 +1113,7 @@ function multi:newProcessor(name, nothread)
function c:newFunction(func, holdme)
return thread:newFunctionBase(function(...)
return c:newThread("Threaded Function Handler", func, ...)
return c:newThread("Process Threaded Function Handler", func, ...)
end, holdme)()
end
@ -1451,7 +1451,9 @@ end
function thread:newFunction(func, holdme)
return thread:newFunctionBase(function(...)
return thread:newThread("Threaded Function Handler", func, ...)
local th = thread:newThread("Free Threaded Function Handler", func, ...)
th.creator = debug.getinfo(2).name
return th
end, holdme)()
end
@ -1485,7 +1487,7 @@ function thread:newProcessor(name)
function proc:newFunction(func, holdme)
return thread:newFunctionBase(function(...)
return thread_proc:newThread("Threaded Function Handler", func, ...)
return thread_proc:newThread("TProc Threaded Function Handler", func, ...)
end, holdme)()
end
@ -1774,6 +1776,7 @@ co_status = {
if _ then
ref.OnDeath:Fire(ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16)
else
print("Thread: ", ref.Name, ref.creator, THREAD_NAME)
ref.OnError:Fire(ref,ret,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16)
end
if i then
@ -2346,8 +2349,8 @@ end
function multi.error(self, err)
if type(err) == "bool" then crash = err end
if type(self) == "string" then err = self end
io.write("\x1b[91mERROR:\x1b[0m " .. err .. "\n")
error("^^^ " .. multi:getCurrentProcess():getFullName() .. " " .. multi:getCurrentTask().Type)
io.write("\x1b[91mERROR:\x1b[0m " .. err .. " " .. debug.getinfo(2).name .."\n")
error("^^^ " .. multi:getCurrentProcess():getFullName() .. " " .. multi:getCurrentTask().Type .. "\n" .. debug.traceback().."\n")
if multi.defaultSettings.error then
os.exit(1)
end

View File

@ -174,7 +174,7 @@ function multi:newSystemThreadedJobQueue(n)
queueReturn:push{jid, funcs[name](multi.unpack(args)), queue}
end).OnError(multi.error)
end
end).OnError(print)
end).OnError(multi.error)
thread:newThread("DoAllHandler",function()
while true do
local dat = thread.hold(function()
@ -190,7 +190,7 @@ function multi:newSystemThreadedJobQueue(n)
end
end
end
end).OnError(print)
end).OnError(multi.error)
thread:newThread("IdleHandler",function()
while true do
thread.hold(function()
@ -198,9 +198,9 @@ function multi:newSystemThreadedJobQueue(n)
end)
THREAD.sleep(.01)
end
end).OnError(print)
end).OnError(multi.error)
multi:mainloop()
end,i).OnError(print)
end,i).OnError(multi.error)
end
return c
end

View File

@ -177,7 +177,7 @@ function multi.InitSystemThreadErrorHandler()
end
end
end
end).OnError(print)
end).OnError(multi.error)
end
multi.print("Integrated Lanes Threading!")

View File

@ -271,7 +271,7 @@ function multi:newSystemThreadedConnection(name)
-- This shouldn't be the case
end
end
end).OnError(print)
end).OnError(multi.error)
return self
end
@ -346,7 +346,7 @@ function multi:newSystemThreadedConnection(name)
c.proxy_conn:Fire(multi.unpack(item[2]))
end
end
end).OnError(print)
end).OnError(multi.error)
--- ^^^ This will only exist in the init thread
THREAD.package(name,c)

View File

@ -125,7 +125,7 @@ function multi:newProxy(list)
self.recv:push(ret)
end
end
end).OnError(print)
end).OnError(multi.error)
return self
else
local multi, thread = require("multi"):init()
@ -300,10 +300,13 @@ function multi:newSystemThreadedProcessor(cores)
return tjq:pop()
end)
if dat then
for i,v in pairs(dat) do
print(i,v)
end
th = thread:newThread("JQ-TargetThread",function()
local name = table.remove(dat, 1)
local jid = table.remove(dat, 1)
local func = table.remove(dat, 1)
local func = _G[name]
local args = table.remove(dat, 1)
th.OnError(function(self,err)
-- We want to pass this to the other calling thread incase
@ -313,7 +316,7 @@ function multi:newSystemThreadedProcessor(cores)
end)
end
end
end).OnError(print)
end).OnError(multi.error)
end)
c.jobqueue:registerFunction("STP_GetThreadCount",function()