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