From 3fa63c937ef4b442d120bc5ba86e9b4eb29b009c Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 16 Apr 2025 00:44:46 +0800 Subject: add thread module stub --- tests/modules/thread/sleep.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/modules/thread/sleep.lua (limited to 'tests/modules/thread/sleep.lua') 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 + -- cgit v1.3.1