aboutsummaryrefslogtreecommitdiff
path: root/test/test_join_detach.lua
diff options
context:
space:
mode:
authormoteus <mimir@newmail.ru>2013-12-26 18:52:58 +0400
committermoteus <mimir@newmail.ru>2013-12-26 18:52:58 +0400
commite3fe5123a36643634e00de6a1bb940e6e1febade (patch)
tree8eecc3aa10e8c6842efe1d798758942f35f555f6 /test/test_join_detach.lua
parent5291caae5be68250a4d9aafa54fe2081ab2a6113 (diff)
downloadlua-llthreads2-e3fe5123a36643634e00de6a1bb940e6e1febade.tar.gz
lua-llthreads2-e3fe5123a36643634e00de6a1bb940e6e1febade.tar.bz2
lua-llthreads2-e3fe5123a36643634e00de6a1bb940e6e1febade.zip
Add. `joinable` parameter to `start` method which control in which thread child Lua VM will be destroyed.
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