diff options
| author | ruki <[email protected]> | 2025-04-16 00:44:46 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-08-28 11:35:53 +0800 |
| commit | 3fa63c937ef4b442d120bc5ba86e9b4eb29b009c (patch) | |
| tree | 98935162c42784aa4ace767daecb8d1fb1847552 /tests/modules/thread | |
| parent | b63b1e9f2635242113724bc8c0f41afbaa15f9ee (diff) | |
add thread module stub
Diffstat (limited to 'tests/modules/thread')
| -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 + |
