Edited symlink
This commit is contained in:
parent
6be948f068
commit
d57dc7dc22
@ -1,23 +1,23 @@
|
|||||||
function love.conf(t)
|
function love.conf(t)
|
||||||
t.identity = nil -- The name of the save directory (string)
|
t.identity = nil -- The name of the save directory (string)
|
||||||
t.version = "11.4" -- The LOVE version this game was made for (string)
|
t.version = "11.4" -- The LOVE version this game was made for (string)
|
||||||
t.console = true -- Attach a console (boolean, Windows only)
|
t.console = true -- Attach a console (boolean, Windows only)
|
||||||
|
|
||||||
t.window = false
|
t.window = false
|
||||||
|
|
||||||
t.modules.audio = false -- Enable the audio module (boolean)
|
t.modules.audio = false -- Enable the audio module (boolean)
|
||||||
t.modules.event = false -- Enable the event module (boolean)
|
t.modules.event = false -- Enable the event module (boolean)
|
||||||
t.modules.graphics = false -- Enable the graphics module (boolean)
|
t.modules.graphics = false -- Enable the graphics module (boolean)
|
||||||
t.modules.image = false -- Enable the image module (boolean)
|
t.modules.image = false -- Enable the image module (boolean)
|
||||||
t.modules.joystick = false -- Enable the joystick module (boolean)
|
t.modules.joystick = false -- Enable the joystick module (boolean)
|
||||||
t.modules.keyboard = false -- Enable the keyboard module (boolean)
|
t.modules.keyboard = false -- Enable the keyboard module (boolean)
|
||||||
t.modules.math = false -- Enable the math module (boolean)
|
t.modules.math = false -- Enable the math module (boolean)
|
||||||
t.modules.mouse = false -- Enable the mouse module (boolean)
|
t.modules.mouse = false -- Enable the mouse module (boolean)
|
||||||
t.modules.physics = false -- Enable the physics module (boolean)
|
t.modules.physics = false -- Enable the physics module (boolean)
|
||||||
t.modules.sound = false -- Enable the sound module (boolean)
|
t.modules.sound = false -- Enable the sound module (boolean)
|
||||||
t.modules.system = false -- Enable the system module (boolean)
|
t.modules.system = false -- Enable the system module (boolean)
|
||||||
t.modules.timer = false -- Enable the timer module (boolean)
|
t.modules.timer = false -- Enable the timer module (boolean)
|
||||||
t.modules.window = false -- Enable the window module (boolean)
|
t.modules.window = false -- Enable the window module (boolean)
|
||||||
t.modules.thread = true -- Enable the thread module (boolean)
|
t.modules.thread = true -- Enable the thread module (boolean)
|
||||||
end
|
end
|
||||||
--1440 x 2560
|
--1440 x 2560
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
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
|
||||||
|
|
||||||
function love.update()
|
function love.update()
|
||||||
multi:uManager()
|
multi:uManager()
|
||||||
end
|
end
|
||||||
1
tests/multi
Symbolic link
1
tests/multi
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../
|
||||||
@ -1,200 +1,200 @@
|
|||||||
if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
|
if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
|
||||||
package.path="multi/?.lua;multi/?/init.lua;multi/?.lua;multi/?/?/init.lua;"..package.path
|
package.path="multi/?.lua;multi/?/init.lua;multi/?.lua;multi/?/?/init.lua;"..package.path
|
||||||
require("lldebugger").start()
|
require("lldebugger").start()
|
||||||
else
|
else
|
||||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
package.path = "../?/init.lua;../?.lua;"..package.path
|
||||||
end
|
end
|
||||||
--[[
|
--[[
|
||||||
This file runs all tests.
|
This file runs all tests.
|
||||||
Format:
|
Format:
|
||||||
Expected:
|
Expected:
|
||||||
...
|
...
|
||||||
...
|
...
|
||||||
...
|
...
|
||||||
Actual:
|
Actual:
|
||||||
...
|
...
|
||||||
...
|
...
|
||||||
...
|
...
|
||||||
|
|
||||||
Each test that is ran should have a 5 second pause after the test is complete
|
Each test that is ran should have a 5 second pause after the test is complete
|
||||||
The expected and actual should "match" (Might be impossible when playing with threads)
|
The expected and actual should "match" (Might be impossible when playing with threads)
|
||||||
This will be pushed directly to the master as tests start existing.
|
This will be pushed directly to the master as tests start existing.
|
||||||
]]
|
]]
|
||||||
local multi, thread = require("multi"):init{print=true,warn=true,error=true}--{priority=true}
|
local multi, thread = require("multi"):init{print=true,warn=true,error=true}--{priority=true}
|
||||||
local good = false
|
local good = false
|
||||||
local proc = multi:newProcessor("Test")
|
local proc = multi:newProcessor("Test")
|
||||||
|
|
||||||
proc.Start()
|
proc.Start()
|
||||||
|
|
||||||
proc:newAlarm(3):OnRing(function()
|
proc:newAlarm(3):OnRing(function()
|
||||||
good = true
|
good = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
runTest = thread:newFunction(function()
|
runTest = thread:newFunction(function()
|
||||||
local alarms,tsteps,steps,loops,tloops,updaters,events=false,0,0,0,0,0,false
|
local alarms,tsteps,steps,loops,tloops,updaters,events=false,0,0,0,0,0,false
|
||||||
multi.print("Testing Basic Features. If this fails most other features will probably not work!")
|
multi.print("Testing Basic Features. If this fails most other features will probably not work!")
|
||||||
proc:newAlarm(2):OnRing(function(a)
|
proc:newAlarm(2):OnRing(function(a)
|
||||||
alarms = true
|
alarms = true
|
||||||
a:Destroy()
|
a:Destroy()
|
||||||
end)
|
end)
|
||||||
proc:newTStep(1,10,1,.1):OnStep(function(t)
|
proc:newTStep(1,10,1,.1):OnStep(function(t)
|
||||||
tsteps = tsteps + 1
|
tsteps = tsteps + 1
|
||||||
end):OnEnd(function(step)
|
end):OnEnd(function(step)
|
||||||
step:Destroy()
|
step:Destroy()
|
||||||
end)
|
end)
|
||||||
proc:newStep(1,10):OnStep(function(s)
|
proc:newStep(1,10):OnStep(function(s)
|
||||||
steps = steps + 1
|
steps = steps + 1
|
||||||
end):OnEnd(function(step)
|
end):OnEnd(function(step)
|
||||||
step:Destroy()
|
step:Destroy()
|
||||||
end)
|
end)
|
||||||
local loop = proc:newLoop(function(l)
|
local loop = proc:newLoop(function(l)
|
||||||
loops = loops + 1
|
loops = loops + 1
|
||||||
end)
|
end)
|
||||||
proc:newTLoop(function(t)
|
proc:newTLoop(function(t)
|
||||||
tloops = tloops + 1
|
tloops = tloops + 1
|
||||||
end,.1)
|
end,.1)
|
||||||
local updater = proc:newUpdater(1):OnUpdate(function()
|
local updater = proc:newUpdater(1):OnUpdate(function()
|
||||||
updaters = updaters + 1
|
updaters = updaters + 1
|
||||||
end)
|
end)
|
||||||
local event = proc:newEvent(function()
|
local event = proc:newEvent(function()
|
||||||
return alarms
|
return alarms
|
||||||
end)
|
end)
|
||||||
event.OnEvent(function(evnt)
|
event.OnEvent(function(evnt)
|
||||||
evnt:Destroy()
|
evnt:Destroy()
|
||||||
events = true
|
events = true
|
||||||
multi.success("Alarms: Ok")
|
multi.success("Alarms: Ok")
|
||||||
multi.success("Events: Ok")
|
multi.success("Events: Ok")
|
||||||
if tsteps == 10 then multi.success("TSteps: Ok") else multi.error("TSteps: Bad!") end
|
if tsteps == 10 then multi.success("TSteps: Ok") else multi.error("TSteps: Bad!") end
|
||||||
if steps == 10 then multi.success("Steps: Ok") else multi.error("Steps: Bad!") end
|
if steps == 10 then multi.success("Steps: Ok") else multi.error("Steps: Bad!") end
|
||||||
if loops > 100 then multi.success("Loops: Ok") else multi.error("Loops: Bad!") end
|
if loops > 100 then multi.success("Loops: Ok") else multi.error("Loops: Bad!") end
|
||||||
if tloops > 10 then multi.success("TLoops: Ok") else multi.error("TLoops: Bad!") end
|
if tloops > 10 then multi.success("TLoops: Ok") else multi.error("TLoops: Bad!") end
|
||||||
if updaters > 100 then multi.success("Updaters: Ok") else multi.error("Updaters: Bad!") end
|
if updaters > 100 then multi.success("Updaters: Ok") else multi.error("Updaters: Bad!") end
|
||||||
end)
|
end)
|
||||||
thread.hold(event.OnEvent)
|
thread.hold(event.OnEvent)
|
||||||
multi.print("Starting Connection and Thread tests!")
|
multi.print("Starting Connection and Thread tests!")
|
||||||
func = thread:newFunction(function(count)
|
func = thread:newFunction(function(count)
|
||||||
multi.print("Starting Status test: ",count)
|
multi.print("Starting Status test: ",count)
|
||||||
local a = 0
|
local a = 0
|
||||||
while true do
|
while true do
|
||||||
a = a + 1
|
a = a + 1
|
||||||
thread.sleep(.1)
|
thread.sleep(.1)
|
||||||
thread.pushStatus(a,count)
|
thread.pushStatus(a,count)
|
||||||
if a == count then break end
|
if a == count then break end
|
||||||
end
|
end
|
||||||
return "Done", true, math.random(1,10000)
|
return "Done", true, math.random(1,10000)
|
||||||
end)
|
end)
|
||||||
local ret = func(10)
|
local ret = func(10)
|
||||||
local ret2 = func(15)
|
local ret2 = func(15)
|
||||||
local ret3 = func(20)
|
local ret3 = func(20)
|
||||||
local s1,s2,s3 = 0,0,0
|
local s1,s2,s3 = 0,0,0
|
||||||
ret.OnError(function(...)
|
ret.OnError(function(...)
|
||||||
multi.error("Func 1:",...)
|
multi.error("Func 1:",...)
|
||||||
end)
|
end)
|
||||||
ret2.OnError(function(...)
|
ret2.OnError(function(...)
|
||||||
multi.error("Func 2:",...)
|
multi.error("Func 2:",...)
|
||||||
end)
|
end)
|
||||||
ret3.OnError(function(...)
|
ret3.OnError(function(...)
|
||||||
multi.error("Func 3:",...)
|
multi.error("Func 3:",...)
|
||||||
end)
|
end)
|
||||||
ret.OnStatus(function(part,whole)
|
ret.OnStatus(function(part,whole)
|
||||||
s1 = math.ceil((part/whole)*1000)/10
|
s1 = math.ceil((part/whole)*1000)/10
|
||||||
end)
|
end)
|
||||||
ret2.OnStatus(function(part,whole)
|
ret2.OnStatus(function(part,whole)
|
||||||
s2 = math.ceil((part/whole)*1000)/10
|
s2 = math.ceil((part/whole)*1000)/10
|
||||||
end)
|
end)
|
||||||
ret3.OnStatus(function(part,whole)
|
ret3.OnStatus(function(part,whole)
|
||||||
s3 = math.ceil((part/whole)*1000)/10
|
s3 = math.ceil((part/whole)*1000)/10
|
||||||
end)
|
end)
|
||||||
|
|
||||||
ret.OnReturn(function(...)
|
ret.OnReturn(function(...)
|
||||||
multi.success("Done 1",...)
|
multi.success("Done 1",...)
|
||||||
end)
|
end)
|
||||||
ret2.OnReturn(function(...)
|
ret2.OnReturn(function(...)
|
||||||
multi.success("Done 2",...)
|
multi.success("Done 2",...)
|
||||||
end)
|
end)
|
||||||
ret3.OnReturn(function(...)
|
ret3.OnReturn(function(...)
|
||||||
multi.success("Done 3",...)
|
multi.success("Done 3",...)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local err, timeout = thread.hold(ret.OnReturn * ret2.OnReturn * ret3.OnReturn)
|
local err, timeout = thread.hold(ret.OnReturn * ret2.OnReturn * ret3.OnReturn)
|
||||||
|
|
||||||
if s1 == 100 and s2 == 100 and s3 == 100 then
|
if s1 == 100 and s2 == 100 and s3 == 100 then
|
||||||
multi.success("Threads: All tests Ok")
|
multi.success("Threads: All tests Ok")
|
||||||
else
|
else
|
||||||
if s1>0 and s2>0 and s3 > 0 then
|
if s1>0 and s2>0 and s3 > 0 then
|
||||||
multi.success("Thread OnStatus: Ok")
|
multi.success("Thread OnStatus: Ok")
|
||||||
else
|
else
|
||||||
multi.error("Threads OnStatus or thread.hold(conn) Error!")
|
multi.error("Threads OnStatus or thread.hold(conn) Error!")
|
||||||
end
|
end
|
||||||
if timeout then
|
if timeout then
|
||||||
multi.error("Connection Error!")
|
multi.error("Connection Error!")
|
||||||
else
|
else
|
||||||
multi.success("Connection Test 1: Ok")
|
multi.success("Connection Test 1: Ok")
|
||||||
end
|
end
|
||||||
multi.error("Connection holding Error!")
|
multi.error("Connection holding Error!")
|
||||||
end
|
end
|
||||||
|
|
||||||
conn1 = proc:newConnection()
|
conn1 = proc:newConnection()
|
||||||
conn2 = proc:newConnection()
|
conn2 = proc:newConnection()
|
||||||
conn3 = proc:newConnection()
|
conn3 = proc:newConnection()
|
||||||
local c1,c2,c3,c4 = false,false,false,false
|
local c1,c2,c3,c4 = false,false,false,false
|
||||||
|
|
||||||
local a = conn1(function()
|
local a = conn1(function()
|
||||||
c1 = true
|
c1 = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local b = conn2(function()
|
local b = conn2(function()
|
||||||
c2 = true
|
c2 = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local c = conn3(function()
|
local c = conn3(function()
|
||||||
c3 = true
|
c3 = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local d = conn3(function()
|
local d = conn3(function()
|
||||||
c4 = true
|
c4 = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
conn1:Fire()
|
conn1:Fire()
|
||||||
conn2:Fire()
|
conn2:Fire()
|
||||||
conn3:Fire()
|
conn3:Fire()
|
||||||
|
|
||||||
if c1 and c2 and c3 and c4 then
|
if c1 and c2 and c3 and c4 then
|
||||||
multi.success("Connection Test 2: Ok")
|
multi.success("Connection Test 2: Ok")
|
||||||
else
|
else
|
||||||
multi.error("Connection Test 2: Error")
|
multi.error("Connection Test 2: Error")
|
||||||
end
|
end
|
||||||
c3 = false
|
c3 = false
|
||||||
c4 = false
|
c4 = false
|
||||||
conn3:Unconnect(d)
|
conn3:Unconnect(d)
|
||||||
conn3:Fire()
|
conn3:Fire()
|
||||||
if c3 and not(c4) then
|
if c3 and not(c4) then
|
||||||
multi.success("Connection Test 3: Ok")
|
multi.success("Connection Test 3: Ok")
|
||||||
else
|
else
|
||||||
multi.error("Connection Test 3: Error removing connection")
|
multi.error("Connection Test 3: Error removing connection")
|
||||||
end
|
end
|
||||||
if not love then
|
if not love then
|
||||||
multi.print("Testing pseudo threading")
|
multi.print("Testing pseudo threading")
|
||||||
os.execute("lua tests/threadtests.lua p")
|
os.execute("lua tests/threadtests.lua p")
|
||||||
multi.print("Testing lanes threading")
|
multi.print("Testing lanes threading")
|
||||||
os.execute("lua tests/threadtests.lua l")
|
os.execute("lua tests/threadtests.lua l")
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local handle = runTest()
|
local handle = runTest()
|
||||||
|
|
||||||
handle.OnError(function(...)
|
handle.OnError(function(...)
|
||||||
multi.error("Something went wrong with the test!")
|
multi.error("Something went wrong with the test!")
|
||||||
print(...)
|
print(...)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not love then
|
if not love then
|
||||||
multi:mainloop()
|
multi:mainloop()
|
||||||
else
|
else
|
||||||
local hold = thread:newFunction(function()
|
local hold = thread:newFunction(function()
|
||||||
thread.hold(handle.OnError + handle.OnReturn)
|
thread.hold(handle.OnError + handle.OnReturn)
|
||||||
end, true)
|
end, true)
|
||||||
hold()
|
hold()
|
||||||
multi.print("Starting Threading tests!")
|
multi.print("Starting Threading tests!")
|
||||||
end
|
end
|
||||||
408
tests/test.lua
408
tests/test.lua
@ -1,205 +1,205 @@
|
|||||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
package.path = "../?/init.lua;../?.lua;"..package.path
|
||||||
multi, thread = require("multi"):init{print=true,warn=true,error=true}
|
multi, thread = require("multi"):init{print=true,warn=true,error=true}
|
||||||
require("multi.integration.priorityManager")
|
require("multi.integration.priorityManager")
|
||||||
|
|
||||||
-- test = multi:newProcessor("Test")
|
-- test = multi:newProcessor("Test")
|
||||||
-- test:setPriorityScheme(multi.priorityScheme.TimeBased)
|
-- test:setPriorityScheme(multi.priorityScheme.TimeBased)
|
||||||
|
|
||||||
-- test:newUpdater(10000000):OnUpdate(function()
|
-- test:newUpdater(10000000):OnUpdate(function()
|
||||||
-- print("Print is slowish")
|
-- print("Print is slowish")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- print("Running...")
|
-- print("Running...")
|
||||||
|
|
||||||
-- local conn1, conn2 = multi:newConnection(), multi:newConnection()
|
-- local conn1, conn2 = multi:newConnection(), multi:newConnection()
|
||||||
-- conn3 = conn1 + conn2
|
-- conn3 = conn1 + conn2
|
||||||
|
|
||||||
-- conn1(function()
|
-- conn1(function()
|
||||||
-- print("Hi 1")
|
-- print("Hi 1")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- conn2(function()
|
-- conn2(function()
|
||||||
-- print("Hi 2")
|
-- print("Hi 2")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- conn3(function()
|
-- conn3(function()
|
||||||
-- print("Hi 3")
|
-- print("Hi 3")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- function test(a,b,c)
|
-- function test(a,b,c)
|
||||||
-- print("I run before all and control if execution should continue!")
|
-- print("I run before all and control if execution should continue!")
|
||||||
-- return a>b
|
-- return a>b
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- conn4 = test .. conn1
|
-- conn4 = test .. conn1
|
||||||
|
|
||||||
-- conn5 = conn2 .. function() print("I run after it all!") end
|
-- conn5 = conn2 .. function() print("I run after it all!") end
|
||||||
|
|
||||||
-- conn4:Fire(3,2,3)
|
-- conn4:Fire(3,2,3)
|
||||||
-- -- This second one won't trigger the Hi's
|
-- -- This second one won't trigger the Hi's
|
||||||
-- conn4:Fire(1,2,3)
|
-- conn4:Fire(1,2,3)
|
||||||
|
|
||||||
-- conn5(function()
|
-- conn5(function()
|
||||||
-- print("Test 1")
|
-- print("Test 1")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- conn5(function()
|
-- conn5(function()
|
||||||
-- print("Test 2")
|
-- print("Test 2")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- conn5(function()
|
-- conn5(function()
|
||||||
-- print("Test 3")
|
-- print("Test 3")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- conn5:Fire()
|
-- conn5:Fire()
|
||||||
multi.print("Testing thread:newProcessor()")
|
multi.print("Testing thread:newProcessor()")
|
||||||
|
|
||||||
proc = thread:newProcessor("Test")
|
proc = thread:newProcessor("Test")
|
||||||
|
|
||||||
proc:newLoop(function()
|
proc:newLoop(function()
|
||||||
multi.print("Running...")
|
multi.print("Running...")
|
||||||
thread.sleep(1)
|
thread.sleep(1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
proc:newThread(function()
|
proc:newThread(function()
|
||||||
while true do
|
while true do
|
||||||
multi.warn("Everything is a thread in this proc!")
|
multi.warn("Everything is a thread in this proc!")
|
||||||
thread.sleep(1)
|
thread.sleep(1)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
multi:mainloop()
|
multi:mainloop()
|
||||||
|
|
||||||
|
|
||||||
-- local conn1, conn2, conn3 = multi:newConnection(nil,nil,true), multi:newConnection(), multi:newConnection()
|
-- local conn1, conn2, conn3 = multi:newConnection(nil,nil,true), multi:newConnection(), multi:newConnection()
|
||||||
|
|
||||||
-- local link = conn1(function()
|
-- local link = conn1(function()
|
||||||
-- print("Conn1, first")
|
-- print("Conn1, first")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- local link2 = conn1(function()
|
-- local link2 = conn1(function()
|
||||||
-- print("Conn1, second")
|
-- print("Conn1, second")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- local link3 = conn1(function()
|
-- local link3 = conn1(function()
|
||||||
-- print("Conn1, third")
|
-- print("Conn1, third")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- local link4 = conn2(function()
|
-- local link4 = conn2(function()
|
||||||
-- print("Conn2, first")
|
-- print("Conn2, first")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- local link5 = conn2(function()
|
-- local link5 = conn2(function()
|
||||||
-- print("Conn2, second")
|
-- print("Conn2, second")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- local link6 = conn2(function()
|
-- local link6 = conn2(function()
|
||||||
-- print("Conn2, third")
|
-- print("Conn2, third")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- print("Links 1-6",link,link2,link3,link4,link5,link6)
|
-- print("Links 1-6",link,link2,link3,link4,link5,link6)
|
||||||
-- conn1:Lock(link)
|
-- conn1:Lock(link)
|
||||||
-- print("All conns\n-------------")
|
-- print("All conns\n-------------")
|
||||||
-- conn1:Fire()
|
-- conn1:Fire()
|
||||||
-- conn2:Fire()
|
-- conn2:Fire()
|
||||||
|
|
||||||
-- conn1:Unlock(link)
|
-- conn1:Unlock(link)
|
||||||
|
|
||||||
-- conn1:Unconnect(link3)
|
-- conn1:Unconnect(link3)
|
||||||
-- conn2:Unconnect(link6)
|
-- conn2:Unconnect(link6)
|
||||||
-- print("All conns Edit\n---------------------")
|
-- print("All conns Edit\n---------------------")
|
||||||
-- conn1:Fire()
|
-- conn1:Fire()
|
||||||
-- conn2:Fire()
|
-- conn2:Fire()
|
||||||
|
|
||||||
-- thread:newThread(function()
|
-- thread:newThread(function()
|
||||||
-- print("Awaiting status")
|
-- print("Awaiting status")
|
||||||
-- thread.hold(conn1 + (conn2 * conn3))
|
-- thread.hold(conn1 + (conn2 * conn3))
|
||||||
-- print("Conn or Conn2 and Conn3")
|
-- print("Conn or Conn2 and Conn3")
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- multi:newAlarm(1):OnRing(function()
|
-- multi:newAlarm(1):OnRing(function()
|
||||||
-- print("Conn")
|
-- print("Conn")
|
||||||
-- conn1:Fire()
|
-- conn1:Fire()
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:newAlarm(2):OnRing(function()
|
-- multi:newAlarm(2):OnRing(function()
|
||||||
-- print("Conn2")
|
-- print("Conn2")
|
||||||
-- conn2:Fire()
|
-- conn2:Fire()
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:newAlarm(3):OnRing(function()
|
-- multi:newAlarm(3):OnRing(function()
|
||||||
-- print("Conn3")
|
-- print("Conn3")
|
||||||
-- conn3:Fire()
|
-- conn3:Fire()
|
||||||
-- os.exit()
|
-- os.exit()
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
|
|
||||||
-- local conn = multi:newSystemThreadedConnection("conn"):init()
|
-- local conn = multi:newSystemThreadedConnection("conn"):init()
|
||||||
|
|
||||||
-- multi:newSystemThread("Thread_Test_1", function()
|
-- multi:newSystemThread("Thread_Test_1", function()
|
||||||
-- local multi, thread = require("multi"):init()
|
-- local multi, thread = require("multi"):init()
|
||||||
-- local conn = GLOBAL["conn"]:init()
|
-- local conn = GLOBAL["conn"]:init()
|
||||||
-- local console = THREAD.getConsole()
|
-- local console = THREAD.getConsole()
|
||||||
-- conn(function(a,b,c)
|
-- conn(function(a,b,c)
|
||||||
-- console.print(THREAD:getName().." was triggered!",a,b,c)
|
-- console.print(THREAD:getName().." was triggered!",a,b,c)
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:mainloop()
|
-- multi:mainloop()
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- multi:newSystemThread("Thread_Test_2", function()
|
-- multi:newSystemThread("Thread_Test_2", function()
|
||||||
-- local multi, thread = require("multi"):init()
|
-- local multi, thread = require("multi"):init()
|
||||||
-- local conn = GLOBAL["conn"]:init()
|
-- local conn = GLOBAL["conn"]:init()
|
||||||
-- local console = THREAD.getConsole()
|
-- local console = THREAD.getConsole()
|
||||||
-- conn(function(a,b,c)
|
-- conn(function(a,b,c)
|
||||||
-- console.print(THREAD:getName().." was triggered!",a,b,c)
|
-- console.print(THREAD:getName().." was triggered!",a,b,c)
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:newAlarm(2):OnRing(function()
|
-- multi:newAlarm(2):OnRing(function()
|
||||||
-- console.print("Fire 2!!!")
|
-- console.print("Fire 2!!!")
|
||||||
-- conn:Fire(4,5,6)
|
-- conn:Fire(4,5,6)
|
||||||
-- THREAD.kill()
|
-- THREAD.kill()
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- multi:mainloop()
|
-- multi:mainloop()
|
||||||
-- end)
|
-- end)
|
||||||
-- local console = THREAD.getConsole()
|
-- local console = THREAD.getConsole()
|
||||||
-- conn(function(a,b,c)
|
-- conn(function(a,b,c)
|
||||||
-- console.print("Mainloop conn got triggered!",a,b,c)
|
-- console.print("Mainloop conn got triggered!",a,b,c)
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- alarm = multi:newAlarm(1)
|
-- alarm = multi:newAlarm(1)
|
||||||
-- alarm:OnRing(function()
|
-- alarm:OnRing(function()
|
||||||
-- console.print("Fire 1!!!")
|
-- console.print("Fire 1!!!")
|
||||||
-- conn:Fire(1,2,3)
|
-- conn:Fire(1,2,3)
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- alarm = multi:newAlarm(3):OnRing(function()
|
-- alarm = multi:newAlarm(3):OnRing(function()
|
||||||
-- multi:newSystemThread("Thread_Test_3",function()
|
-- multi:newSystemThread("Thread_Test_3",function()
|
||||||
-- local multi, thread = require("multi"):init()
|
-- local multi, thread = require("multi"):init()
|
||||||
-- local conn = GLOBAL["conn"]:init()
|
-- local conn = GLOBAL["conn"]:init()
|
||||||
-- local console = THREAD.getConsole()
|
-- local console = THREAD.getConsole()
|
||||||
-- conn(function(a,b,c)
|
-- conn(function(a,b,c)
|
||||||
-- console.print(THREAD:getName().." was triggered!",a,b,c)
|
-- console.print(THREAD:getName().." was triggered!",a,b,c)
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:newAlarm(4):OnRing(function()
|
-- multi:newAlarm(4):OnRing(function()
|
||||||
-- console.print("Fire 3!!!")
|
-- console.print("Fire 3!!!")
|
||||||
-- conn:Fire(7,8,9)
|
-- conn:Fire(7,8,9)
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:mainloop()
|
-- multi:mainloop()
|
||||||
-- end)
|
-- end)
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- multi:newSystemThread("Thread_Test_4",function()
|
-- multi:newSystemThread("Thread_Test_4",function()
|
||||||
-- local multi, thread = require("multi"):init()
|
-- local multi, thread = require("multi"):init()
|
||||||
-- local conn = GLOBAL["conn"]:init()
|
-- local conn = GLOBAL["conn"]:init()
|
||||||
-- local conn2 = multi:newConnection()
|
-- local conn2 = multi:newConnection()
|
||||||
-- local console = THREAD.getConsole()
|
-- local console = THREAD.getConsole()
|
||||||
-- multi:newAlarm(2):OnRing(function()
|
-- multi:newAlarm(2):OnRing(function()
|
||||||
-- conn2:Fire()
|
-- conn2:Fire()
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:newThread(function()
|
-- multi:newThread(function()
|
||||||
-- console.print("Conn Test!")
|
-- console.print("Conn Test!")
|
||||||
-- thread.hold(conn + conn2)
|
-- thread.hold(conn + conn2)
|
||||||
-- console.print("It held!")
|
-- console.print("It held!")
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:mainloop()
|
-- multi:mainloop()
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
-- multi:mainloop()
|
-- multi:mainloop()
|
||||||
@ -1,247 +1,247 @@
|
|||||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
package.path = "../?/init.lua;../?.lua;"..package.path
|
||||||
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
|
||||||
local env, we_good
|
local env, we_good
|
||||||
|
|
||||||
if love then
|
if love then
|
||||||
GLOBAL, THREAD = require("multi.integration.loveManager"):init()
|
GLOBAL, THREAD = require("multi.integration.loveManager"):init()
|
||||||
env = LOVE
|
env = LOVE
|
||||||
elseif arg[1] == "l" then
|
elseif arg[1] == "l" then
|
||||||
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
||||||
env = LANES
|
env = LANES
|
||||||
elseif arg[1] == "p" then
|
elseif arg[1] == "p" then
|
||||||
GLOBAL, THREAD = require("multi.integration.pseudoManager"):init()
|
GLOBAL, THREAD = require("multi.integration.pseudoManager"):init()
|
||||||
env = PSEUDO
|
env = PSEUDO
|
||||||
else
|
else
|
||||||
io.write("Test Pseudo(p), Lanes(l), or love(Run in love environment) Threading: ")
|
io.write("Test Pseudo(p), Lanes(l), or love(Run in love environment) Threading: ")
|
||||||
choice = io.read()
|
choice = io.read()
|
||||||
if choice == "p" then
|
if choice == "p" then
|
||||||
GLOBAL, THREAD = require("multi.integration.pseudoManager"):init()
|
GLOBAL, THREAD = require("multi.integration.pseudoManager"):init()
|
||||||
env = PSEUDO
|
env = PSEUDO
|
||||||
elseif choice == "l" then
|
elseif choice == "l" then
|
||||||
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
||||||
env = LANES
|
env = LANES
|
||||||
else
|
else
|
||||||
error("Invalid threading choice")
|
error("Invalid threading choice")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
multi.print("Testing THREAD.setENV() if the multi_assert is not found then there is a problem")
|
multi.print("Testing THREAD.setENV() if the multi_assert is not found then there is a problem")
|
||||||
THREAD.setENV({
|
THREAD.setENV({
|
||||||
multi_assert = function(expected, actual, s)
|
multi_assert = function(expected, actual, s)
|
||||||
if expected ~= actual then
|
if expected ~= actual then
|
||||||
multi.error(s .. " Expected: '".. tostring(expected) .."' Actual: '".. tostring(actual) .."'")
|
multi.error(s .. " Expected: '".. tostring(expected) .."' Actual: '".. tostring(actual) .."'")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
multi:newThread("Scheduler Thread",function()
|
multi:newThread("Scheduler Thread",function()
|
||||||
queue = multi:newSystemThreadedQueue("Test_Queue"):init()
|
queue = multi:newSystemThreadedQueue("Test_Queue"):init()
|
||||||
|
|
||||||
multi:newSystemThread("Test_Thread_0", function()
|
multi:newSystemThread("Test_Thread_0", function()
|
||||||
print("The name should be Test_Thread_0",THREAD_NAME,THREAD_NAME,_G.THREAD_NAME)
|
print("The name should be Test_Thread_0",THREAD_NAME,THREAD_NAME,_G.THREAD_NAME)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
th1 = multi:newSystemThread("Test_Thread_1", function(a,b,c,d,e,f)
|
th1 = multi:newSystemThread("Test_Thread_1", function(a,b,c,d,e,f)
|
||||||
queue = THREAD.waitFor("Test_Queue"):init()
|
queue = THREAD.waitFor("Test_Queue"):init()
|
||||||
multi_assert("Test_Thread_1", THREAD_NAME, "Thread name does not match!")
|
multi_assert("Test_Thread_1", THREAD_NAME, "Thread name does not match!")
|
||||||
multi_assert("Passing some args", a, "First argument is not as expected 'Passing some args'")
|
multi_assert("Passing some args", a, "First argument is not as expected 'Passing some args'")
|
||||||
multi_assert(true, e, "Argument e is not true!")
|
multi_assert(true, e, "Argument e is not true!")
|
||||||
multi_assert("table", type(f), "Argument f is not a table!")
|
multi_assert("table", type(f), "Argument f is not a table!")
|
||||||
queue:push("done")
|
queue:push("done")
|
||||||
end,"Passing some args", 1, 2, 3, true, {"Table"}).OnError(function(self,err)
|
end,"Passing some args", 1, 2, 3, true, {"Table"}).OnError(function(self,err)
|
||||||
multi.error(err)
|
multi.error(err)
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if thread.hold(function()
|
if thread.hold(function()
|
||||||
return queue:pop() == "done"
|
return queue:pop() == "done"
|
||||||
end,{sleep=1}) == nil then
|
end,{sleep=1}) == nil then
|
||||||
thread.kill()
|
thread.kill()
|
||||||
end
|
end
|
||||||
|
|
||||||
multi.success("Thread Spawning, THREAD namaspace in threads, global's working, and queues for passing data: Ok")
|
multi.success("Thread Spawning, THREAD namaspace in threads, global's working, and queues for passing data: Ok")
|
||||||
|
|
||||||
func = THREAD:newFunction(function(a,b,c)
|
func = THREAD:newFunction(function(a,b,c)
|
||||||
assert(a == 3, "First argument expected '3' got '".. a .."'!")
|
assert(a == 3, "First argument expected '3' got '".. a .."'!")
|
||||||
assert(b == 2, "Second argument expected '2' got '".. a .."'!")
|
assert(b == 2, "Second argument expected '2' got '".. a .."'!")
|
||||||
assert(c == 1, "Third argument expected '1' got '".. a .."'!")
|
assert(c == 1, "Third argument expected '1' got '".. a .."'!")
|
||||||
return 1, 2, 3, {"a table"}
|
return 1, 2, 3, {"a table"}
|
||||||
end, true) -- Hold this
|
end, true) -- Hold this
|
||||||
|
|
||||||
a, b, c, d = func(3,2,1)
|
a, b, c, d = func(3,2,1)
|
||||||
|
|
||||||
assert(a == 1, "First return was not '1'!")
|
assert(a == 1, "First return was not '1'!")
|
||||||
assert(b == 2, "Second return was not '2'!")
|
assert(b == 2, "Second return was not '2'!")
|
||||||
assert(c == 3, "Third return was not '3'!")
|
assert(c == 3, "Third return was not '3'!")
|
||||||
assert(d[1] == "a table", "Fourth return is not table, or doesn't contain 'a table'!")
|
assert(d[1] == "a table", "Fourth return is not table, or doesn't contain 'a table'!")
|
||||||
|
|
||||||
multi.success("Threaded Functions, arg passing, return passing, holding: Ok")
|
multi.success("Threaded Functions, arg passing, return passing, holding: Ok")
|
||||||
|
|
||||||
test=multi:newSystemThreadedTable("YO"):init()
|
test=multi:newSystemThreadedTable("YO"):init()
|
||||||
test["test1"]="tabletest"
|
test["test1"]="tabletest"
|
||||||
local worked = false
|
local worked = false
|
||||||
|
|
||||||
multi:newSystemThread("testing tables",function()
|
multi:newSystemThread("testing tables",function()
|
||||||
tab=THREAD.waitFor("YO"):init()
|
tab=THREAD.waitFor("YO"):init()
|
||||||
THREAD.hold(function() return tab["test1"] end)
|
THREAD.hold(function() return tab["test1"] end)
|
||||||
THREAD.sleep(.1)
|
THREAD.sleep(.1)
|
||||||
tab["test2"] = "Whats so funny?"
|
tab["test2"] = "Whats so funny?"
|
||||||
end).OnError(multi.error)
|
end).OnError(multi.error)
|
||||||
|
|
||||||
multi:newThread("test2",function()
|
multi:newThread("test2",function()
|
||||||
thread.hold(function() return test["test2"] end)
|
thread.hold(function() return test["test2"] end)
|
||||||
worked = true
|
worked = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
t, val = thread.hold(function()
|
t, val = thread.hold(function()
|
||||||
return worked
|
return worked
|
||||||
end,{sleep=1})
|
end,{sleep=1})
|
||||||
|
|
||||||
if val == multi.TIMEOUT then
|
if val == multi.TIMEOUT then
|
||||||
multi.error("SystemThreadedTables: Failed")
|
multi.error("SystemThreadedTables: Failed")
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
multi.success("SystemThreadedTables: Ok")
|
multi.success("SystemThreadedTables: Ok")
|
||||||
|
|
||||||
local ready = false
|
local ready = false
|
||||||
|
|
||||||
jq = multi:newSystemThreadedJobQueue(5) -- Job queue with 4 worker threads
|
jq = multi:newSystemThreadedJobQueue(5) -- Job queue with 4 worker threads
|
||||||
func = jq:newFunction("test-thread",function(a,b)
|
func = jq:newFunction("test-thread",function(a,b)
|
||||||
THREAD.sleep(.2)
|
THREAD.sleep(.2)
|
||||||
return a+b
|
return a+b
|
||||||
end)
|
end)
|
||||||
local count = 0
|
local count = 0
|
||||||
for i = 1,10 do
|
for i = 1,10 do
|
||||||
func(i, i*3).OnReturn(function(data)
|
func(i, i*3).OnReturn(function(data)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
t, val = thread.hold(function()
|
t, val = thread.hold(function()
|
||||||
return count == 10
|
return count == 10
|
||||||
end,{sleep=2})
|
end,{sleep=2})
|
||||||
|
|
||||||
if val == multi.TIMEOUT then
|
if val == multi.TIMEOUT then
|
||||||
multi.error("SystemThreadedJobQueues: Failed")
|
multi.error("SystemThreadedJobQueues: Failed")
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
multi.success("SystemThreadedJobQueues: Ok")
|
multi.success("SystemThreadedJobQueues: Ok")
|
||||||
|
|
||||||
-- queue2 = multi:newSystemThreadedQueue("Test_Queue2"):init()
|
-- queue2 = multi:newSystemThreadedQueue("Test_Queue2"):init()
|
||||||
-- multi:newSystemThread("Test_Thread_2",function()
|
-- multi:newSystemThread("Test_Thread_2",function()
|
||||||
-- queue2 = THREAD.waitFor("Test_Queue2"):init()
|
-- queue2 = THREAD.waitFor("Test_Queue2"):init()
|
||||||
-- connOut = THREAD.waitFor("ConnectionNAMEHERE"):init()
|
-- connOut = THREAD.waitFor("ConnectionNAMEHERE"):init()
|
||||||
-- connOut(function(arg)
|
-- connOut(function(arg)
|
||||||
-- queue2:push("Test_Thread_2")
|
-- queue2:push("Test_Thread_2")
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:mainloop()
|
-- multi:mainloop()
|
||||||
-- end).OnError(multi.error)
|
-- end).OnError(multi.error)
|
||||||
-- multi:newSystemThread("Test_Thread_3",function()
|
-- multi:newSystemThread("Test_Thread_3",function()
|
||||||
-- queue2 = THREAD.waitFor("Test_Queue2"):init()
|
-- queue2 = THREAD.waitFor("Test_Queue2"):init()
|
||||||
-- connOut = THREAD.waitFor("ConnectionNAMEHERE"):init()
|
-- connOut = THREAD.waitFor("ConnectionNAMEHERE"):init()
|
||||||
-- connOut(function(arg)
|
-- connOut(function(arg)
|
||||||
-- queue2:push("Test_Thread_3")
|
-- queue2:push("Test_Thread_3")
|
||||||
-- end)
|
-- end)
|
||||||
-- multi:mainloop()
|
-- multi:mainloop()
|
||||||
-- end).OnError(multi.error)
|
-- end).OnError(multi.error)
|
||||||
-- connOut = multi:newSystemThreadedConnection("ConnectionNAMEHERE"):init()
|
-- connOut = multi:newSystemThreadedConnection("ConnectionNAMEHERE"):init()
|
||||||
-- a=0
|
-- a=0
|
||||||
-- connOut(function(arg)
|
-- connOut(function(arg)
|
||||||
-- queue2:push("Main")
|
-- queue2:push("Main")
|
||||||
-- end)
|
-- end)
|
||||||
-- for i=1,3 do
|
-- for i=1,3 do
|
||||||
-- thread.sleep(.1)
|
-- thread.sleep(.1)
|
||||||
-- connOut:Fire("Test From Main Thread: "..i.."\n")
|
-- connOut:Fire("Test From Main Thread: "..i.."\n")
|
||||||
-- end
|
-- end
|
||||||
-- thread.sleep(2)
|
-- thread.sleep(2)
|
||||||
-- local count = 0
|
-- local count = 0
|
||||||
-- multi:newThread(function()
|
-- multi:newThread(function()
|
||||||
-- while count < 9 do
|
-- while count < 9 do
|
||||||
-- if queue2:pop() then
|
-- if queue2:pop() then
|
||||||
-- count = count + 1
|
-- count = count + 1
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- end).OnError(multi.error)
|
-- end).OnError(multi.error)
|
||||||
-- _, err = thread.hold(function() return count == 9 end,{sleep=.3})
|
-- _, err = thread.hold(function() return count == 9 end,{sleep=.3})
|
||||||
-- if err == multi.TIMEOUT then
|
-- if err == multi.TIMEOUT then
|
||||||
-- multi.error("SystemThreadedConnections: Failed")
|
-- multi.error("SystemThreadedConnections: Failed")
|
||||||
-- end
|
-- end
|
||||||
-- multi.success("SystemThreadedConnections: Ok")
|
-- multi.success("SystemThreadedConnections: Ok")
|
||||||
|
|
||||||
local stp = multi:newSystemThreadedProcessor(8)
|
local stp = multi:newSystemThreadedProcessor(8)
|
||||||
|
|
||||||
local tloop = stp:newTLoop(nil, 1)
|
local tloop = stp:newTLoop(nil, 1)
|
||||||
|
|
||||||
local proxy_test = false
|
local proxy_test = false
|
||||||
|
|
||||||
multi:newSystemThread("Testing proxy copy THREAD",function(tloop)
|
multi:newSystemThread("Testing proxy copy THREAD",function(tloop)
|
||||||
local multi, thread = require("multi"):init()
|
local multi, thread = require("multi"):init()
|
||||||
tloop = tloop:init()
|
tloop = tloop:init()
|
||||||
multi.print("tloop type:",tloop.Type)
|
multi.print("tloop type:",tloop.Type)
|
||||||
multi.print("Testing proxies on other threads")
|
multi.print("Testing proxies on other threads")
|
||||||
thread:newThread(function()
|
thread:newThread(function()
|
||||||
while true do
|
while true do
|
||||||
thread.hold(tloop.OnLoop)
|
thread.hold(tloop.OnLoop)
|
||||||
print(THREAD_NAME,"Loopy")
|
print(THREAD_NAME,"Loopy")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
tloop.OnLoop(function(a)
|
tloop.OnLoop(function(a)
|
||||||
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()).OnError(multi.error)
|
||||||
|
|
||||||
multi.print("tloop", tloop.Type)
|
multi.print("tloop", tloop.Type)
|
||||||
multi.print("tloop.OnLoop", tloop.OnLoop.Type)
|
multi.print("tloop.OnLoop", tloop.OnLoop.Type)
|
||||||
|
|
||||||
thread:newThread(function()
|
thread:newThread(function()
|
||||||
multi.print("Testing holding on a proxy connection!")
|
multi.print("Testing holding on a proxy connection!")
|
||||||
thread.hold(tloop.OnLoop)
|
thread.hold(tloop.OnLoop)
|
||||||
multi.print("Held on proxy connection... once")
|
multi.print("Held on proxy connection... once")
|
||||||
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(print)
|
end).OnError(print)
|
||||||
|
|
||||||
thread:newThread(function()
|
thread:newThread(function()
|
||||||
while true do
|
while true do
|
||||||
thread.hold(tloop.OnLoop)
|
thread.hold(tloop.OnLoop)
|
||||||
print(THREAD_NAME,"Loopy")
|
print(THREAD_NAME,"Loopy")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
tloop.OnLoop(function()
|
tloop.OnLoop(function()
|
||||||
print("OnLoop",THREAD_NAME)
|
print("OnLoop",THREAD_NAME)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
t, val = thread.hold(function()
|
t, val = thread.hold(function()
|
||||||
return count == 10
|
return count == 10
|
||||||
end,{sleep=5})
|
end,{sleep=5})
|
||||||
|
|
||||||
if val == multi.TIMEOUT then
|
if val == multi.TIMEOUT then
|
||||||
multi.error("SystemThreadedProcessor/Proxies: Failed")
|
multi.error("SystemThreadedProcessor/Proxies: Failed")
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
thread.sleep(2)
|
thread.sleep(2)
|
||||||
|
|
||||||
multi.success("SystemThreadedProcessor: OK")
|
multi.success("SystemThreadedProcessor: OK")
|
||||||
|
|
||||||
we_good = true
|
we_good = true
|
||||||
os.exit()
|
os.exit()
|
||||||
end).OnError(multi.error)
|
end).OnError(multi.error)
|
||||||
|
|
||||||
multi.OnExit(function(err_or_errorcode)
|
multi.OnExit(function(err_or_errorcode)
|
||||||
if not we_good then
|
if not we_good then
|
||||||
multi.info("There was an error running some tests!")
|
multi.info("There was an error running some tests!")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
multi.success("Tests complete!")
|
multi.success("Tests complete!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
multi:mainloop()
|
multi:mainloop()
|
||||||
Loading…
x
Reference in New Issue
Block a user