diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/testLua/luaprocTest2.lua | 77 |
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 @@ | |||
1 | require "luaproc" | ||
2 | |||
3 | result, error_msg = luaproc.createworker() | ||
4 | if not result then print(error_msg) end | ||
5 | result, error_msg = luaproc.createworker() | ||
6 | if not result then print(error_msg) end | ||
7 | result, error_msg = luaproc.createworker() | ||
8 | if not result then print(error_msg) end | ||
9 | result, error_msg = luaproc.createworker() | ||
10 | if not result then print(error_msg) end | ||
11 | |||
12 | count = 0 | ||
13 | |||
14 | proc = [=[ | ||
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 | |||
37 | mainProc = [=[ | ||
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 | |||
66 | for 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 | ||
69 | end | ||
70 | |||
71 | print("Started " .. count .. " Lua threads.") | ||
72 | |||
73 | result, error_msg = luaproc.newproc(string.format(mainProc, count)) | ||
74 | if not result then print(error_msg) end | ||
75 | |||
76 | luaproc.exit() | ||
77 | |||