mirror of
https://github.com/rayaman/multi.git
synced 2026-09-05 07:27:35 -04:00
Started work on the debugManager
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
local multi, thread = require("multi"):init()
|
||||
|
||||
local dbg = {}
|
||||
|
||||
local creation_hook
|
||||
|
||||
creation_hook = function(obj, process)
|
||||
print("Created: ",obj.Type, "in", process.Type, process:getFullName())
|
||||
if obj.Type == multi.PROCESS then
|
||||
obj.OnObjectCreated(creation_hook)
|
||||
end
|
||||
end
|
||||
|
||||
local tmulti = multi:getThreadManagerProcess()
|
||||
multi.OnObjectCreated(creation_hook)
|
||||
tmulti.OnObjectCreated(creation_hook)
|
||||
|
||||
--[[
|
||||
multi.ROOTPROCESS = "rootprocess"
|
||||
multi.CONNECTOR = "connector"
|
||||
multi.TIMEMASTER = "timemaster"
|
||||
multi.PROCESS = "process"
|
||||
multi.TIMER = "timer"
|
||||
multi.EVENT = "event"
|
||||
multi.UPDATER = "updater"
|
||||
multi.ALARM = "alarm"
|
||||
multi.LOOP = "loop"
|
||||
multi.TLOOP = "tloop"
|
||||
multi.STEP = "step"
|
||||
multi.TSTEP = "tstep"
|
||||
multi.THREAD = "thread"
|
||||
multi.SERVICE = "service"
|
||||
multi.PROXY = "proxy"
|
||||
multi.THREADEDFUNCTION = "threaded_function"
|
||||
]]
|
||||
|
||||
return dbg
|
||||
@@ -133,6 +133,7 @@ function multi:newSystemThreadedJobQueue(n)
|
||||
link = c.OnJobCompleted(function(jid,...)
|
||||
if id==jid then
|
||||
rets = multi.pack(...)
|
||||
c.OnJobCompleted:Unconnect(link)
|
||||
end
|
||||
end)
|
||||
return thread.hold(function()
|
||||
|
||||
@@ -32,7 +32,9 @@ if multi.integration then -- This allows us to call the lanes manager from suppo
|
||||
}
|
||||
end
|
||||
-- Step 1 get lanes
|
||||
lanes = require("lanes").configure()
|
||||
lanes = require("lanes").configure{
|
||||
nb_keepers = 4,
|
||||
}
|
||||
multi.SystemThreads = {}
|
||||
multi.isMainThread = true
|
||||
|
||||
|
||||
@@ -329,33 +329,5 @@ function multi:newSystemThreadedProcessor(cores)
|
||||
return false
|
||||
end
|
||||
|
||||
c.getLoad = thread:newFunction(function(self, tp)
|
||||
local loads = {}
|
||||
local func
|
||||
|
||||
if tp then
|
||||
func = "STP_GetThreadCount"
|
||||
else
|
||||
func = "STP_GetTaskCount"
|
||||
end
|
||||
|
||||
for i,v in pairs(self.proc_list) do
|
||||
local conn
|
||||
local jid = self:pushJob(v, func)
|
||||
|
||||
conn = self.jobqueue.OnJobCompleted(function(id, data)
|
||||
if id == jid then
|
||||
table.insert(loads, {v, data})
|
||||
multi:newTask(function()
|
||||
self.jobqueue.OnJobCompleted:Unconnect(conn)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
thread.hold(function() return #loads == c.cores end)
|
||||
return loads
|
||||
end, true)
|
||||
|
||||
return c
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user