V15.3.0 #46
@ -100,6 +100,9 @@ function multi:newSystemThread(name, func, ...)
|
||||
GLOBAL["__THREADS__"] = livingThreads
|
||||
return c
|
||||
end
|
||||
|
||||
THREAD.newSystemThread = multi.newSystemThread
|
||||
|
||||
function multi.InitSystemThreadErrorHandler()
|
||||
if started == true then
|
||||
return
|
||||
|
||||
@ -144,6 +144,7 @@ function multi:newSystemThread(name,func,...)
|
||||
end)
|
||||
return c
|
||||
end
|
||||
THREAD.newSystemThread = multi.newSystemThread
|
||||
function love.threaderror(thread, errorstr)
|
||||
print("Thread error!\n"..errorstr)
|
||||
end
|
||||
|
||||
@ -76,6 +76,7 @@ function multi:newSystemThread(name,func,...)
|
||||
THREAD_ID=THREAD_ID+1
|
||||
return c
|
||||
end
|
||||
THREAD.newSystemThread = multi.newSystemThread
|
||||
function lovr.threaderror(thread, errorstr)
|
||||
print("Thread error!\n"..errorstr)
|
||||
end
|
||||
|
||||
@ -116,6 +116,7 @@ local function _INIT(luvitThread, timer)
|
||||
luvitThread.start(entry, package.path, name, c.func, ...)
|
||||
return c
|
||||
end
|
||||
THREAD.newSystemThread = multi.newSystemThread
|
||||
multi.print("Integrated Luvit!")
|
||||
multi.integration = {} -- for module creators
|
||||
multi.integration.GLOBAL = GLOBAL
|
||||
|
||||
63
test.lua
63
test.lua
@ -1,32 +1,45 @@
|
||||
package.path = "./?/init.lua;"..package.path
|
||||
multi, thread = require("multi"):init()
|
||||
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
||||
|
||||
local proc = multi:newProcessor("Test")
|
||||
local proc2 = multi:newProcessor("Test2")
|
||||
local proc3 = proc2:newProcessor("Test3")
|
||||
|
||||
function multi:getTaskStats()
|
||||
local stats = {
|
||||
[multi.Name] = {
|
||||
threads = multi:getThreads(),
|
||||
tasks = multi:getTasks()
|
||||
}
|
||||
}
|
||||
local procs = multi:getProcessors()
|
||||
for i = 1, #procs do
|
||||
local proc = procs[i]
|
||||
stats[proc:getFullName()] = {
|
||||
threads = proc:getThreads(),
|
||||
tasks = proc:getTasks()
|
||||
}
|
||||
end
|
||||
return stats
|
||||
THREAD:newSystemThread("Test",function()
|
||||
print("In a thread...")
|
||||
while true do
|
||||
THREAD.sleep(1)
|
||||
print("In thread")
|
||||
end
|
||||
end)
|
||||
|
||||
local tasks = multi:getTaskStats()
|
||||
multi:newTLoop(function()
|
||||
print("...")
|
||||
end,1)
|
||||
|
||||
for i,v in pairs(tasks) do
|
||||
print("Process: "..i)
|
||||
end
|
||||
-- local proc = multi:newProcessor("Test")
|
||||
-- local proc2 = multi:newProcessor("Test2")
|
||||
-- local proc3 = proc2:newProcessor("Test3")
|
||||
|
||||
--multi:mainloop()
|
||||
-- function multi:getTaskStats()
|
||||
-- local stats = {
|
||||
-- [multi.Name] = {
|
||||
-- threads = multi:getThreads(),
|
||||
-- tasks = multi:getTasks()
|
||||
-- }
|
||||
-- }
|
||||
-- local procs = multi:getProcessors()
|
||||
-- for i = 1, #procs do
|
||||
-- local proc = procs[i]
|
||||
-- stats[proc:getFullName()] = {
|
||||
-- threads = proc:getThreads(),
|
||||
-- tasks = proc:getTasks()
|
||||
-- }
|
||||
-- end
|
||||
-- return stats
|
||||
-- end
|
||||
|
||||
-- local tasks = multi:getTaskStats()
|
||||
|
||||
-- for i,v in pairs(tasks) do
|
||||
-- print("Process: "..i)
|
||||
-- end
|
||||
|
||||
multi:mainloop()
|
||||
Loading…
x
Reference in New Issue
Block a user