aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_join_detach.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test_join_detach.lua b/test/test_join_detach.lua
index dd3ef11..329fb27 100644
--- a/test/test_join_detach.lua
+++ b/test/test_join_detach.lua
@@ -22,5 +22,33 @@ end
22-- we should not hungup 22-- we should not hungup
23for i = 1, 10 do collectgarbage("collect") end 23for i = 1, 10 do collectgarbage("collect") end
24 24
25
26do
27
28local thread = llthreads.new(utils.thread_init .. [[
29 local sleep = require"utils".sleep
30 sleep(1)
31]])
32
33-- detached + joindable
34thread:start(true, true)
35
36local ok, err = thread:join(0)
37print("thread:join(0): ", ok, err)
38assert(ok == nil)
39assert(err == "timeout")
40
41utils.sleep(5)
42local ok, err = thread:join(0)
43print("thread:join(0): ", ok, err)
44assert(ok)
45
46end
47
48-- enforce collect `thread` object
49-- we should not get av
50for i = 1, 10 do collectgarbage("collect") end
51
52
25print("Done!") 53print("Done!")
26 54