aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/testLua/luaprocTest2.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LuaSL/testLua/luaprocTest2.lua77
1 files changed, 0 insertions, 77 deletions
diff --git a/LuaSL/testLua/luaprocTest2.lua b/LuaSL/testLua/luaprocTest2.lua
deleted file mode 100644
index 07a3dc8..0000000
--- a/LuaSL/testLua/luaprocTest2.lua
+++ /dev/null
@@ -1,77 +0,0 @@
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
12count = 0
13
14proc = [=[
15 require "string"
16 local channel = "channel%d"
17 local message
18
19 result, error_msg = luaproc.newchannel(channel)
20 if not result then print(error_msg) end
21 repeat
22 message = luaproc.receive(channel)
23 local x, y = string.find(message, "@")
24 if not x then
25 x, y = string.find(message, "@")
26 x, y = string.find(message, "@")
27 x, y = string.find(message, "@")
28 x, y = string.find(message, "@")
29 x, y = string.find(message, "@")
30 x, y = string.find(message, "@")
31 x, y = string.find(message, "@")
32 x, y = string.find(message, "@")
33 end
34 until "quit" == message
35]=]
36
37mainProc = [=[
38 local count = %d
39 local messages = 0
40 local length = 0
41 local message = "This is a test message. 56789 12"
42
43 if 0 ~= count then
44 for k = 0, 16 do
45 for j = 0, 199 do
46 for i = 1, count do
47 result, error_msg = luaproc.send("channel" .. i, message)
48 if not result then print(error_msg .. " " .. i) else
49 messages = messages + 1
50 length = length + #message
51 end
52 end
53 end
54 message = message .. message
55 end
56
57 for i = 1, count do
58 result, error_msg = luaproc.send("channel" .. i, "quit")
59 if not result then print(error_msg .. " " .. i) end
60 end
61 end
62
63 print("Sent " .. messages .. " messages totalling " .. length .. " bytes. The largest message was " .. #message .. " bytes.")
64]=]
65
66for i = 1, 10 do
67 result, error_msg = luaproc.newproc(string.format(proc, i))
68 if not result then print(error_msg) else count = count + 1 end
69end
70
71print("Started " .. count .. " Lua threads.")
72
73result, error_msg = luaproc.newproc(string.format(mainProc, count))
74if not result then print(error_msg) end
75
76luaproc.exit()
77