aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/testLua/luaprocTest1.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LuaSL/testLua/luaprocTest1.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/LuaSL/testLua/luaprocTest1.lua b/LuaSL/testLua/luaprocTest1.lua
new file mode 100644
index 0000000..3fe4811
--- /dev/null
+++ b/LuaSL/testLua/luaprocTest1.lua
@@ -0,0 +1,41 @@
1require "luaproc"
2
3result, error_msg = luaproc.createworker()
4if not result then print(error_msg) end
5result, error_msg = luaproc.createworker()
6if not result then print(error_msg) end
7result, error_msg = luaproc.createworker()
8if not result then print(error_msg) end
9result, error_msg = luaproc.createworker()
10if not result then print(error_msg) end
11
12result, error_msg = luaproc.newproc( [=[
13
14 local count = 0
15
16-- Hmm, luajit 2 beta 9 crashes at about 8140, lua can go up to 50000 at least.
17 for i = 1, 8000 do
18 local channel = "channel" .. i
19-- local proc = 'print(luaproc.receive("channel' .. i .. '") .. " " .. ' .. i ..')'
20 local proc = 'luaproc.receive("' .. channel .. '")'
21
22-- print(channel .. "\n" .. proc)
23 result, error_msg = luaproc.newchannel(channel)
24 if not result then print(error_msg) end
25 result, error_msg = luaproc.newproc(proc)
26 if not result then print(error_msg) else count = count + 1 end
27 end
28
29 print("Started " .. count .. " Lua threads")
30
31 if 0 ~= count then
32 for i = 1, count do
33 result, error_msg = luaproc.send("channel" .. i, 'luaproc is working fine! ' .. i)
34 if not result then print(error_msg .. " " .. i) end
35 end
36 end
37]=] )
38if not result then print(error_msg .. " for main proc") end
39
40luaproc.exit()
41