Working on 16.0.0 #53
3
init.lua
3
init.lua
@ -1423,7 +1423,7 @@ function thread:newFunctionBase(generator, holdme, TYPE)
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
t.OnDeath(function(...) temp.OnReturn:Fire(...) end)
|
t.OnDeath(function(...) temp.OnReturn:Fire(...) end)
|
||||||
t.OnError(function(self,err) temp.OnError:Fire(err) end)
|
t.OnError(function(self,err) temp.OnError:Fire(err) temp.OnError(multi.error) end)
|
||||||
t.linkedFunction = temp
|
t.linkedFunction = temp
|
||||||
t.statusconnector = temp.OnStatus
|
t.statusconnector = temp.OnStatus
|
||||||
return temp
|
return temp
|
||||||
@ -1885,6 +1885,7 @@ function multi:newService(func) -- Priority managed threads
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
th.OnError = c.OnError -- use the threads onerror as our own
|
th.OnError = c.OnError -- use the threads onerror as our own
|
||||||
|
th.OnError(multi.error)
|
||||||
|
|
||||||
function c.Destroy()
|
function c.Destroy()
|
||||||
th:kill()
|
th:kill()
|
||||||
|
|||||||
@ -207,9 +207,9 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
local jid = table.remove(dat, 1)
|
local jid = table.remove(dat, 1)
|
||||||
local args = table.remove(dat, 1)
|
local args = table.remove(dat, 1)
|
||||||
queueReturn:push{jid, funcs[name](args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]), queue}
|
queueReturn:push{jid, funcs[name](args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]), queue}
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
thread:newThread("DoAllHandler",function()
|
thread:newThread("DoAllHandler",function()
|
||||||
while true do
|
while true do
|
||||||
local dat = thread.hold(function()
|
local dat = thread.hold(function()
|
||||||
@ -225,7 +225,7 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
thread:newThread("IdleHandler",function()
|
thread:newThread("IdleHandler",function()
|
||||||
while true do
|
while true do
|
||||||
thread.hold(function()
|
thread.hold(function()
|
||||||
@ -233,9 +233,9 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
end)
|
end)
|
||||||
THREAD.sleep(.01)
|
THREAD.sleep(.01)
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
multi:mainloop()
|
multi:mainloop()
|
||||||
end,i).OnError(multi.error)
|
end,i)
|
||||||
end
|
end
|
||||||
|
|
||||||
function c:Hold(opt)
|
function c:Hold(opt)
|
||||||
|
|||||||
@ -130,6 +130,7 @@ function multi:newSystemThread(name, func, ...)
|
|||||||
c.OnDeath = multi:newConnection()
|
c.OnDeath = multi:newConnection()
|
||||||
c.OnError = multi:newConnection()
|
c.OnError = multi:newConnection()
|
||||||
GLOBAL["__THREADS__"] = livingThreads
|
GLOBAL["__THREADS__"] = livingThreads
|
||||||
|
c.OnError(multi.error)
|
||||||
|
|
||||||
if self.isActor then
|
if self.isActor then
|
||||||
self:create(c)
|
self:create(c)
|
||||||
|
|||||||
@ -172,6 +172,7 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
multi:newSystemThread("JobQueue_"..jqc.."_worker_"..i,function(jqc)
|
multi:newSystemThread("JobQueue_"..jqc.."_worker_"..i,function(jqc)
|
||||||
local multi, thread = require("multi"):init()
|
local multi, thread = require("multi"):init()
|
||||||
require("love.timer")
|
require("love.timer")
|
||||||
|
love.timer.sleep(1)
|
||||||
local clock = os.clock
|
local clock = os.clock
|
||||||
local funcs = THREAD.createTable("__JobQueue_"..jqc.."_table")
|
local funcs = THREAD.createTable("__JobQueue_"..jqc.."_table")
|
||||||
local queue = THREAD.waitFor("__JobQueue_"..jqc.."_queue")
|
local queue = THREAD.waitFor("__JobQueue_"..jqc.."_queue")
|
||||||
@ -208,11 +209,12 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
local id = table.remove(dat,1)
|
local id = table.remove(dat,1)
|
||||||
local tab = {funcs[name](multi.unpack(dat))}
|
local tab = {funcs[name](multi.unpack(dat))}
|
||||||
table.insert(tab,1,id)
|
table.insert(tab,1,id)
|
||||||
|
--local test = queueReturn.push
|
||||||
queueReturn:push(tab)
|
queueReturn:push(tab)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
thread:newThread("Idler",function()
|
thread:newThread("Idler",function()
|
||||||
while true do
|
while true do
|
||||||
thread.yield()
|
thread.yield()
|
||||||
|
|||||||
@ -60,6 +60,8 @@ function multi:newSystemThread(name, func, ...)
|
|||||||
|
|
||||||
table.insert(threads, c)
|
table.insert(threads, c)
|
||||||
|
|
||||||
|
c.OnError(multi.error)
|
||||||
|
|
||||||
if self.isActor then
|
if self.isActor then
|
||||||
self:create(c)
|
self:create(c)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -300,7 +300,7 @@ function multi:newSystemThreadedConnection(name)
|
|||||||
-- This shouldn't be the case
|
-- This shouldn't be the case
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ function multi:newSystemThreadedConnection(name)
|
|||||||
c.proxy_conn:Fire(multi.unpack(item[2]))
|
c.proxy_conn:Fire(multi.unpack(item[2]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
--- ^^^ This will only exist in the init thread
|
--- ^^^ This will only exist in the init thread
|
||||||
|
|
||||||
THREAD.package(name,c)
|
THREAD.package(name,c)
|
||||||
|
|||||||
@ -104,6 +104,8 @@ function multi:newSystemThread(name, func, ...)
|
|||||||
c.stab.returns = nil
|
c.stab.returns = nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
c.OnError(multi.error)
|
||||||
|
|
||||||
if self.isActor then
|
if self.isActor then
|
||||||
self:create(c)
|
self:create(c)
|
||||||
|
|||||||
@ -210,7 +210,7 @@ local function init_chronos()
|
|||||||
thread.yield()
|
thread.yield()
|
||||||
priorityManager.run()
|
priorityManager.run()
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if chronos then
|
if chronos then
|
||||||
|
|||||||
@ -35,15 +35,16 @@ end
|
|||||||
|
|
||||||
function multi:newSystemThreadedQueue(name)
|
function multi:newSystemThreadedQueue(name)
|
||||||
local c = {}
|
local c = {}
|
||||||
|
c.data = {}
|
||||||
c.Type = multi.registerType("s_queue")
|
c.Type = multi.registerType("s_queue")
|
||||||
function c:push(v)
|
function c:push(v)
|
||||||
table.insert(self,v)
|
table.insert(self,v)
|
||||||
end
|
end
|
||||||
function c:pop()
|
function c:pop()
|
||||||
return table.remove(self,1)
|
return table.remove(self.data,1)
|
||||||
end
|
end
|
||||||
function c:peek()
|
function c:peek()
|
||||||
return self[1]
|
return self.data[1]
|
||||||
end
|
end
|
||||||
function c:init()
|
function c:init()
|
||||||
return self
|
return self
|
||||||
@ -156,6 +157,7 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
end)
|
end)
|
||||||
for i=1,c.cores do
|
for i=1,c.cores do
|
||||||
multi:newSystemThread("JobQueue_"..jqc.."_worker_"..i,function(jqc)
|
multi:newSystemThread("JobQueue_"..jqc.."_worker_"..i,function(jqc)
|
||||||
|
local GLOBAL, THREAD = require("multi.integration.pseudoManager"):init()
|
||||||
local multi, thread = require("multi"):init()
|
local multi, thread = require("multi"):init()
|
||||||
local clock = os.clock
|
local clock = os.clock
|
||||||
local funcs = THREAD.waitFor("__JobQueue_"..jqc.."_table")
|
local funcs = THREAD.waitFor("__JobQueue_"..jqc.."_table")
|
||||||
@ -197,7 +199,7 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
thread:newThread("Idler",function()
|
thread:newThread("Idler",function()
|
||||||
while true do
|
while true do
|
||||||
thread.yield()
|
thread.yield()
|
||||||
|
|||||||
@ -92,6 +92,7 @@ function multi:newSystemThread(name, func, ...)
|
|||||||
|
|
||||||
local th = thread:newISOThread(name, func, env, ...)
|
local th = thread:newISOThread(name, func, env, ...)
|
||||||
th.Type = multi.registerType("s_thread", "pseudoThreads")
|
th.Type = multi.registerType("s_thread", "pseudoThreads")
|
||||||
|
th.OnError(multi.error)
|
||||||
|
|
||||||
id = id + 1
|
id = id + 1
|
||||||
|
|
||||||
|
|||||||
@ -92,6 +92,8 @@ function multi:newProxy(list)
|
|||||||
local sref = table.remove(data, 1)
|
local sref = table.remove(data, 1)
|
||||||
local ret
|
local ret
|
||||||
|
|
||||||
|
print(_G[list[0]], func)
|
||||||
|
|
||||||
if sref then
|
if sref then
|
||||||
ret = {_G[list[0]][func](_G[list[0]], multi.unpack(data))}
|
ret = {_G[list[0]][func](_G[list[0]], multi.unpack(data))}
|
||||||
else
|
else
|
||||||
@ -115,7 +117,7 @@ function multi:newProxy(list)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
return self
|
return self
|
||||||
else
|
else
|
||||||
local function copy(obj)
|
local function copy(obj)
|
||||||
@ -143,6 +145,7 @@ function multi:newProxy(list)
|
|||||||
setmetatable(v[2],getmetatable(multi:newConnection()))
|
setmetatable(v[2],getmetatable(multi:newConnection()))
|
||||||
else
|
else
|
||||||
self[v] = thread:newFunction(function(self,...)
|
self[v] = thread:newFunction(function(self,...)
|
||||||
|
multi.print("Pushing: " .. v)
|
||||||
if self == me then
|
if self == me then
|
||||||
me.send:push({v, true, ...})
|
me.send:push({v, true, ...})
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
package.path = "../?/init.lua;../?.lua;"..package.path
|
||||||
require("runtests")
|
-- require("runtests")
|
||||||
require("threadtests")
|
-- require("threadtests")
|
||||||
-- Allows you to run "love tests" which runs the tests
|
-- Allows you to run "love tests" which runs the tests
|
||||||
|
|
||||||
|
multi, thread = require("multi"):init()
|
||||||
|
GLOBAL, THREAD = require("multi.integration.loveManager"):init()
|
||||||
|
|
||||||
|
|
||||||
function love.update()
|
function love.update()
|
||||||
multi:uManager()
|
multi:uManager()
|
||||||
end
|
end
|
||||||
@ -1,4 +1,5 @@
|
|||||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
package.path = "D:/VSCWorkspace/?/init.lua;D:/VSCWorkspace/?.lua;"..package.path
|
||||||
|
package.cpath = "C:/luaInstalls/lua5.4/lib/lua/5.4/?/core.dll;" .. package.cpath
|
||||||
multi, thread = require("multi"):init{error=true,warning=true,print=true}--{priority=true}
|
multi, thread = require("multi"):init{error=true,warning=true,print=true}--{priority=true}
|
||||||
proc = multi:newProcessor("Thread Test",true)
|
proc = multi:newProcessor("Thread Test",true)
|
||||||
local LANES, LOVE, PSEUDO = 1, 2, 3
|
local LANES, LOVE, PSEUDO = 1, 2, 3
|
||||||
@ -37,12 +38,12 @@ THREAD.setENV({
|
|||||||
})
|
})
|
||||||
|
|
||||||
multi:newThread("Scheduler Thread",function()
|
multi:newThread("Scheduler Thread",function()
|
||||||
multi:newThread(function()
|
-- multi:newThread(function()
|
||||||
thread.sleep(30)
|
-- thread.sleep(30)
|
||||||
print("Timeout tests took longer than 30 seconds")
|
-- print("Timeout tests took longer than 30 seconds")
|
||||||
multi:Stop()
|
-- multi:Stop()
|
||||||
os.exit(1)
|
-- os.exit(1)
|
||||||
end)
|
-- end)
|
||||||
queue = multi:newSystemThreadedQueue("Test_Queue"):init()
|
queue = multi:newSystemThreadedQueue("Test_Queue"):init()
|
||||||
|
|
||||||
multi:newSystemThread("Test_Thread_0", function()
|
multi:newSystemThread("Test_Thread_0", function()
|
||||||
@ -201,7 +202,7 @@ multi:newThread("Scheduler Thread",function()
|
|||||||
print(THREAD_NAME, "Got loop...")
|
print(THREAD_NAME, "Got loop...")
|
||||||
end)
|
end)
|
||||||
multi:mainloop()
|
multi:mainloop()
|
||||||
end, tloop:getTransferable()).OnError(multi.error)
|
end, tloop:getTransferable())
|
||||||
|
|
||||||
multi.print("tloop", tloop.Type)
|
multi.print("tloop", tloop.Type)
|
||||||
multi.print("tloop.OnLoop", tloop.OnLoop.Type)
|
multi.print("tloop.OnLoop", tloop.OnLoop.Type)
|
||||||
@ -213,12 +214,13 @@ multi:newThread("Scheduler Thread",function()
|
|||||||
thread.hold(tloop.OnLoop)
|
thread.hold(tloop.OnLoop)
|
||||||
multi.print("Held on proxy connection... twice")
|
multi.print("Held on proxy connection... twice")
|
||||||
proxy_test = true
|
proxy_test = true
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
|
|
||||||
thread:newThread(function()
|
thread:newThread(function()
|
||||||
|
print("While Test!")
|
||||||
while true do
|
while true do
|
||||||
thread.hold(tloop.OnLoop)
|
thread.hold(tloop.OnLoop)
|
||||||
print(THREAD_NAME,"Loopy")
|
print(THREAD_NAME,"Local Loopy")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -228,7 +230,7 @@ multi:newThread("Scheduler Thread",function()
|
|||||||
|
|
||||||
t, val = thread.hold(function()
|
t, val = thread.hold(function()
|
||||||
return proxy_test
|
return proxy_test
|
||||||
end,{sleep=5})
|
end--[[,{sleep=5}]]) -- No timeouts
|
||||||
|
|
||||||
if val == multi.TIMEOUT then
|
if val == multi.TIMEOUT then
|
||||||
multi.error("SystemThreadedProcessor/Proxies: Failed")
|
multi.error("SystemThreadedProcessor/Proxies: Failed")
|
||||||
@ -242,7 +244,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)
|
os.exit(0)
|
||||||
end).OnError(multi.error)
|
end)
|
||||||
|
|
||||||
multi.OnExit(function(err_or_errorcode)
|
multi.OnExit(function(err_or_errorcode)
|
||||||
print("Error Code: ", err_or_errorcode)
|
print("Error Code: ", err_or_errorcode)
|
||||||
|
|||||||
1102
tests/vscode-debuggee.lua
Normal file
1102
tests/vscode-debuggee.lua
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user