Fixed tests on lanes and pseudo threading, todo fix love2d threading

This commit is contained in:
2023-11-26 12:49:23 -05:00
parent 8d843a5958
commit 91561f7f24
8 changed files with 78 additions and 26 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
package.path = "../?/init.lua;../?.lua;"..package.path
-- require("runtests")
-- require("threadtests")
require("runtests")
require("threadtests")
-- Allows you to run "love tests" which runs the tests
multi, thread = require("multi"):init()
+4 -1
View File
@@ -175,7 +175,7 @@ runTest = thread:newFunction(function()
end
if not love then
local ec = 0
if _VERSION == "5.1" then
if _VERSION == "Lua 5.1" then
multi.print("Testing pseudo threading")
_, str, ecc = os.execute("lua tests/threadtests.lua p")
ec = ec + ecc
@@ -185,14 +185,17 @@ runTest = thread:newFunction(function()
if ec ~= 0 then
os.exit(1)
end
os.exit(0)
else
multi.print("Testing pseudo threading")
ec = ec + os.execute("lua tests/threadtests.lua p")
multi.print("Testing lanes threading")
ec = ec + os.execute("lua tests/threadtests.lua l")
multi:Stop()
if ec ~= 0 then
os.exit(1)
end
os.exit(0)
end
end
end)
+33 -1
View File
@@ -1,5 +1,8 @@
package.path = "../?/init.lua;../?.lua;"..package.path
multi, thread = require("multi"):init{print=true,warn=true,debugging=true}
for i,v in pairs(thread) do
print(i,v)
end
-- require("multi.integration.priorityManager")
-- multi.debugging.OnObjectCreated(function(obj, process)
@@ -266,4 +269,33 @@ multi:mainloop()
-- multi:mainloop()
-- end)
-- multi:mainloop()
-- multi:mainloop()
--[[
newFunction function: 0x00fad170
waitFor function: 0x00fad0c8
request function: 0x00fa4f10
newThread function: 0x00fad1b8
--__threads table: 0x00fa4dc8
defer function: 0x00fa4f98
isThread function: 0x00facd40
holdFor function: 0x00fa5058
yield function: 0x00faccf8
hold function: 0x00fa51a0
chain function: 0x00fa5180
__CORES 32
newISOThread function: 0x00fad250
newFunctionBase function: 0x00fad128
requests table: 0x00fa4e68
newProcessor function: 0x00fad190
exec function: 0x00fa50e8
pushStatus function: 0x00fad108
kill function: 0x00faccd8
get function: 0x00fad0a8
set function: 0x00fad088
getCores function: 0x00facd60
skip function: 0x00faccb0
--_Requests function: 0x00fa50a0
getRunningThread function: 0x00fa4fb8
holdWithin function: 0x00facc80
sleep function: 0x00fa4df0
]]
+5 -5
View File
@@ -146,7 +146,7 @@ multi:newThread("Scheduler Thread",function()
local stp = multi:newSystemThreadedProcessor(5)
local tloop = stp:newTLoop(function()
print("Test")
--print("Test")
end, 1)
multi:newSystemThread("Testing proxy copy THREAD",function(tloop)
@@ -157,11 +157,11 @@ multi:newThread("Scheduler Thread",function()
thread:newThread(function()
while true do
thread.hold(tloop.OnLoop)
print(THREAD_NAME,"Loopy")
--print(THREAD_NAME,"Loopy")
end
end)
tloop.OnLoop(function(a)
print(THREAD_NAME, "Got loop...")
--print(THREAD_NAME, "Got loop...")
end)
multi:mainloop()
end, tloop:getTransferable())
@@ -183,12 +183,12 @@ multi:newThread("Scheduler Thread",function()
thread:newThread(function()
while true do
thread.hold(tloop.OnLoop)
print(THREAD_NAME,"Local Loopy")
--print(THREAD_NAME,"Local Loopy")
end
end)
tloop.OnLoop(function()
print("OnLoop",THREAD_NAME)
--print("OnLoop",THREAD_NAME)
end)
t, val = thread.hold(function()