tests
This commit is contained in:
parent
fd8e77555a
commit
2d239c65ea
49
test.lua
49
test.lua
@ -1,44 +1,17 @@
|
|||||||
package.path="?.lua;?/init.lua;?.lua;?/?/init.lua;"..package.path
|
package.path="?.lua;?/init.lua;?.lua;?/?/init.lua;"..package.path
|
||||||
local multi,thread = require("multi"):init()
|
local multi,thread = require("multi"):init()
|
||||||
|
local GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
||||||
-- Testing destroying and fixed connections
|
multi:newSystemThread("test",function(msg)
|
||||||
c = multi:newConnection()
|
print("In thread:", THREAD.getID(), "Msg:", msg)
|
||||||
c1 = c(function()
|
while true do
|
||||||
print("called 1")
|
-- Hold forever :D
|
||||||
end)
|
end
|
||||||
c2 = c(function()
|
end,"Passing a message")
|
||||||
print("called 2")
|
multi:newThread("localthread",function()
|
||||||
end)
|
print("In local thread :D")
|
||||||
c3 = c(function()
|
|
||||||
print("called 3")
|
|
||||||
end)
|
|
||||||
|
|
||||||
print(c1,c2.Type,c3)
|
|
||||||
c:Fire()
|
|
||||||
c2:Destroy()
|
|
||||||
print(c1,c2.Type,c3)
|
|
||||||
c:Fire()
|
|
||||||
c1:Destroy()
|
|
||||||
print(c1,c2.Type,c3)
|
|
||||||
c:Fire()
|
|
||||||
|
|
||||||
-- Destroying alarms and threads
|
|
||||||
local test = multi:newThread(function()
|
|
||||||
while true do
|
while true do
|
||||||
thread.sleep(1)
|
thread.sleep(1)
|
||||||
print("Hello!")
|
print("...")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
multi:mainloop()
|
||||||
test.OnDeath(function()
|
|
||||||
os.exit() -- This is the last thing called.
|
|
||||||
end)
|
|
||||||
|
|
||||||
local alarm = multi:newAlarm(4):OnRing(function(a)
|
|
||||||
print(a.Type)
|
|
||||||
a:Destroy()
|
|
||||||
print(a.Type)
|
|
||||||
test:Destroy()
|
|
||||||
print("TEST: ",test)
|
|
||||||
end)
|
|
||||||
multi:lightloop()
|
|
||||||
Loading…
x
Reference in New Issue
Block a user