Some work on the debug manager, proxies working on lanes, todo get pseudo manager and love2d working
This commit is contained in:
parent
3d55704726
commit
ad929da484
@ -38,22 +38,62 @@ end .. multi:newConnection()
|
||||
|
||||
local creation_hook, destruction_hook
|
||||
local types
|
||||
local processes = {}
|
||||
local objects = {}
|
||||
|
||||
creation_hook = function(obj, process)
|
||||
types = multi:getTypes()
|
||||
if obj.Type == multi.PROCESS and not dbg.processors[obj] then
|
||||
obj.OnObjectCreated(creation_hook)
|
||||
obj.OnObjectDestroyed(destruction_hook)
|
||||
dbg.processors[obj] = {}
|
||||
end
|
||||
|
||||
table.insert(objects, obj)
|
||||
|
||||
dbg.OnObjectCreated:Fire(obj, process)
|
||||
end
|
||||
|
||||
destruction_hook = function(obj, process)
|
||||
for i = 1, #objects do
|
||||
if objects[i] == obj then
|
||||
table.remove(objects, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
dbg.OnObjectDestroyed:Fire(obj, process)
|
||||
end
|
||||
|
||||
function dbg:getObjects(typ)
|
||||
if type(typ) == "string" then
|
||||
local objs = {}
|
||||
for i = 1, #objects do
|
||||
if objects[i].Type == typ then
|
||||
objs[#objs+1] = objects[i]
|
||||
end
|
||||
end
|
||||
return objs
|
||||
elseif type(typ) == "table" then -- Process
|
||||
local objs = {}
|
||||
for i = 1, #objects do
|
||||
if objects[i].Parent == typ then
|
||||
objs[#objs+1] = objects[i]
|
||||
end
|
||||
end
|
||||
return objs
|
||||
elseif type(typ) == "function" then
|
||||
local objs = {}
|
||||
-- Keep objects local/private, return true to add to list, false to reject, "break" to break loop
|
||||
for i = 1, #objects do
|
||||
local ret = typ(objects[i])
|
||||
if ret then
|
||||
objs[#objs+1] = objects[i]
|
||||
elseif ret == "break" then
|
||||
break
|
||||
end
|
||||
end
|
||||
return objs
|
||||
end
|
||||
end
|
||||
|
||||
local debug_stats = {}
|
||||
|
||||
local tmulti = multi:getThreadManagerProcess()
|
||||
|
||||
@ -184,10 +184,10 @@ function multi:newProxy(list)
|
||||
cp.funcs = copy(self._funcs)
|
||||
cp.init = function(self)
|
||||
local multi, thread = require("multi"):init()
|
||||
-- if multi.integration then
|
||||
-- GLOBAL = multi.integration.GLOBAL
|
||||
-- THREAD = multi.integration.THREAD
|
||||
-- end
|
||||
if multi.integration then
|
||||
GLOBAL = multi.integration.GLOBAL
|
||||
THREAD = multi.integration.THREAD
|
||||
end
|
||||
local proxy = THREAD.waitFor(self.proxy_link)
|
||||
for i,v in pairs(proxy) do
|
||||
print("proxy",i,v)
|
||||
|
||||
@ -1 +0,0 @@
|
||||
../
|
||||
1
lovethreads/multi
Normal file
1
lovethreads/multi
Normal file
@ -0,0 +1 @@
|
||||
../
|
||||
@ -180,16 +180,6 @@ multi:newThread("Scheduler Thread",function()
|
||||
-- end
|
||||
-- multi.success("SystemThreadedConnections: Ok")
|
||||
local proxy_test = false
|
||||
multi:newThread(function()
|
||||
t, val = thread.hold(function()
|
||||
return proxy_test
|
||||
end,{sleep=5})
|
||||
if val == multi.TIMEOUT then
|
||||
multi.error("SystemThreadedProcessor/Proxies: Failed")
|
||||
end
|
||||
thread.sleep(1)
|
||||
os.exit(1)
|
||||
end)
|
||||
local stp = multi:newSystemThreadedProcessor(5)
|
||||
|
||||
local tloop = stp:newTLoop(function()
|
||||
@ -251,6 +241,7 @@ multi:newThread("Scheduler Thread",function()
|
||||
|
||||
we_good = true
|
||||
multi:Stop() -- Needed in love2d tests to stop the main runner
|
||||
os.exit(0)
|
||||
end).OnError(multi.error)
|
||||
|
||||
multi.OnExit(function(err_or_errorcode)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user