diff options
Diffstat (limited to 'tests/modules/thread/sleep.lua')
| -rw-r--r-- | tests/modules/thread/sleep.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/modules/thread/sleep.lua b/tests/modules/thread/sleep.lua new file mode 100644 index 000000000..1a6ed8d91 --- /dev/null +++ b/tests/modules/thread/sleep.lua @@ -0,0 +1,17 @@ +import("core.thread.thread") + +function callback(id) + print("%s: %d ..", thread.running(), id) + local dt = os.mclock() + os.sleep(1000) + dt = os.mclock() - dt + print("%s: %d end, dt: %d ms", thread.running(), id, dt) +end + +function main() + for i = 1, 10 do + thread.new(callback, {argv = {i}, name = "session_" .. i}):start() + end + --thread.wait() +end + |
