blob: 06a95a674b4ade84cd0add182fe7e080a1eb68d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import("core.base.pipe")
import("core.base.scheduler")
function _session(id)
local pipefile = pipe.open("test" .. id, 'w')
local count = 0
while count < 10000 do
local write = pipefile:write("hello world..", {block = true})
if write <= 0 then
break
end
count = count + 1
end
print("%s/%d: write ok, count: %d!", pipefile, id, count)
pipefile:close()
end
function main(count)
count = count and tonumber(count) or 1
for i = 1, count do
scheduler.co_start(_session, i)
end
end
|