summaryrefslogtreecommitdiff
path: root/tests/modules/scheduler/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-04 00:58:36 +0800
committerruki <[email protected]>2020-02-07 22:45:56 +0800
commit0c3f6069c16dbc7b6612fb792cbe6b990a7acef2 (patch)
treedde9571fe643e4b70e4a52ba68762e815757655c /tests/modules/scheduler/test.lua
parentff45e17b26152544961e52671d61aa5f8e838d38 (diff)
remove scheduler.runloop in outside
Diffstat (limited to 'tests/modules/scheduler/test.lua')
-rw-r--r--tests/modules/scheduler/test.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/modules/scheduler/test.lua b/tests/modules/scheduler/test.lua
index 07af3dd80..d6e090c6a 100644
--- a/tests/modules/scheduler/test.lua
+++ b/tests/modules/scheduler/test.lua
@@ -7,10 +7,11 @@ function test_runjobs(t)
t:are_equal(a, "xmake!")
count = count + 1
end
+ local cotasks = {}
for i = 1, 100 do
- scheduler.co_start(task, "xmake!")
+ table.insert(cotasks, scheduler.co_start(task, "xmake!"))
end
- scheduler.runloop()
+ scheduler.co_waitexit(cotasks)
t:are_equal(count, 100)
end
@@ -36,9 +37,10 @@ function test_yield(t)
scheduler.co_yield()
count = count + 1
end
+ local cotasks = {}
for i = 1, 10 do
- scheduler.co_start(task)
+ table.insert(cotasks, scheduler.co_start(task))
end
- scheduler.runloop()
+ scheduler.co_waitexit(cotasks)
t:are_equal(count, 10)
end