aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/testLua/luaprocTest1_C.lua
blob: 61cb461cd88610a3274f33723f65e86d50712820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
result, error_msg = luaproc.newproc( [=[

    local count = 0

-- Hmm, luajit 2 beta 9 crashes at about 8140, lua can go up to 50000 at least.
    for i = 1, 8000 do
	local channel = "channel" .. i
--	local proc = 'print(luaproc.receive("channel' .. i .. '") .. " " .. ' .. i ..')'
	local proc = 'luaproc.receive("' .. channel .. '")'

--	print(channel .. "\n" .. proc)
	result, error_msg = luaproc.newchannel(channel)
	if not result then print(error_msg) end
	result, error_msg = luaproc.newproc(proc)
	if not result then print(error_msg) else count = count + 1 end
    end

    print("Started " .. count .. " Lua threads")

    if 0 ~= count then
	for i = 1, count do
	    result, error_msg = luaproc.send("channel" .. i, 'luaproc is working fine! ' .. i)
	    if not result then print(error_msg .. " " .. i) end
	end
    end
]=] )
if not result then print(error_msg .. " for main proc") end