summaryrefslogtreecommitdiff
path: root/test/test_join_detach.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_join_detach.lua')
-rw-r--r--test/test_join_detach.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_join_detach.lua b/test/test_join_detach.lua
new file mode 100644
index 0000000..dd3ef11
--- /dev/null
+++ b/test/test_join_detach.lua
@@ -0,0 +1,26 @@
1local llthreads = require"llthreads"
2local utils = require "utils"
3
4do
5
6local thread = llthreads.new(utils.thread_init .. [[
7 local sleep = require"utils".sleep
8 while true do sleep(1) end
9]])
10
11-- detached + joindable
12thread:start(true, true)
13
14local ok, err = thread:join(0)
15print("thread:join(0): ", ok, err)
16assert(ok == nil)
17assert(err == "timeout")
18
19end
20
21-- enforce collect `thread` object
22-- we should not hungup
23for i = 1, 10 do collectgarbage("collect") end
24
25print("Done!")
26