aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormoteus <mimir@newmail.ru>2013-12-27 15:39:38 +0400
committermoteus <mimir@newmail.ru>2013-12-27 15:39:38 +0400
commita26ecf383900e4c396958da80200cb2eb1121506 (patch)
treebe2909b271537c31e4b3973d89f02696712f2779 /test
parentbccb6bef9d7eb56eece7efa96524a5fea1eb8d73 (diff)
downloadlua-llthreads2-a26ecf383900e4c396958da80200cb2eb1121506.tar.gz
lua-llthreads2-a26ecf383900e4c396958da80200cb2eb1121506.tar.bz2
lua-llthreads2-a26ecf383900e4c396958da80200cb2eb1121506.zip
Fix. detach joined thread.
Fix. try use child Lua state in join for detached thread.
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