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 creation_hook, destruction_hook
|
||||||
local types
|
local types
|
||||||
local processes = {}
|
local objects = {}
|
||||||
|
|
||||||
creation_hook = function(obj, process)
|
creation_hook = function(obj, process)
|
||||||
types = multi:getTypes()
|
types = multi:getTypes()
|
||||||
if obj.Type == multi.PROCESS and not dbg.processors[obj] then
|
if obj.Type == multi.PROCESS and not dbg.processors[obj] then
|
||||||
obj.OnObjectCreated(creation_hook)
|
obj.OnObjectCreated(creation_hook)
|
||||||
obj.OnObjectDestroyed(destruction_hook)
|
obj.OnObjectDestroyed(destruction_hook)
|
||||||
dbg.processors[obj] = {}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
table.insert(objects, obj)
|
||||||
|
|
||||||
dbg.OnObjectCreated:Fire(obj, process)
|
dbg.OnObjectCreated:Fire(obj, process)
|
||||||
end
|
end
|
||||||
|
|
||||||
destruction_hook = function(obj, process)
|
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)
|
dbg.OnObjectDestroyed:Fire(obj, process)
|
||||||
end
|
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 debug_stats = {}
|
||||||
|
|
||||||
local tmulti = multi:getThreadManagerProcess()
|
local tmulti = multi:getThreadManagerProcess()
|
||||||
|
|||||||
@ -184,10 +184,10 @@ function multi:newProxy(list)
|
|||||||
cp.funcs = copy(self._funcs)
|
cp.funcs = copy(self._funcs)
|
||||||
cp.init = function(self)
|
cp.init = function(self)
|
||||||
local multi, thread = require("multi"):init()
|
local multi, thread = require("multi"):init()
|
||||||
-- if multi.integration then
|
if multi.integration then
|
||||||
-- GLOBAL = multi.integration.GLOBAL
|
GLOBAL = multi.integration.GLOBAL
|
||||||
-- THREAD = multi.integration.THREAD
|
THREAD = multi.integration.THREAD
|
||||||
-- end
|
end
|
||||||
local proxy = THREAD.waitFor(self.proxy_link)
|
local proxy = THREAD.waitFor(self.proxy_link)
|
||||||
for i,v in pairs(proxy) do
|
for i,v in pairs(proxy) do
|
||||||
print("proxy",i,v)
|
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
|
-- end
|
||||||
-- multi.success("SystemThreadedConnections: Ok")
|
-- multi.success("SystemThreadedConnections: Ok")
|
||||||
local proxy_test = false
|
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 stp = multi:newSystemThreadedProcessor(5)
|
||||||
|
|
||||||
local tloop = stp:newTLoop(function()
|
local tloop = stp:newTLoop(function()
|
||||||
@ -251,6 +241,7 @@ multi:newThread("Scheduler Thread",function()
|
|||||||
|
|
||||||
we_good = true
|
we_good = true
|
||||||
multi:Stop() -- Needed in love2d tests to stop the main runner
|
multi:Stop() -- Needed in love2d tests to stop the main runner
|
||||||
|
os.exit(0)
|
||||||
end).OnError(multi.error)
|
end).OnError(multi.error)
|
||||||
|
|
||||||
multi.OnExit(function(err_or_errorcode)
|
multi.OnExit(function(err_or_errorcode)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user