summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoteus <mimir@newmail.ru>2013-12-31 13:11:28 +0400
committermoteus <mimir@newmail.ru>2013-12-31 13:11:28 +0400
commitaf2087987852b6250e7aaafd626e292893d43a7d (patch)
treef85ba1b7cfddea43d34afaa6140ca29b1ea1bc87
parent0b91ddda94b7b1d98036ac92b25dd8221f2fd661 (diff)
downloadlua-llthreads2-af2087987852b6250e7aaafd626e292893d43a7d.tar.gz
lua-llthreads2-af2087987852b6250e7aaafd626e292893d43a7d.tar.bz2
lua-llthreads2-af2087987852b6250e7aaafd626e292893d43a7d.zip
Add. test for lua-llthreas2 module.
-rw-r--r--.travis.yml2
-rw-r--r--README.md8
-rw-r--r--test/test_load_llthreads2.lua7
3 files changed, 13 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index 95708f1..38b2ca6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,6 +41,7 @@ before_install:
41install: 41install:
42 - sudo luarocks install lunitx 42 - sudo luarocks install lunitx
43 - sudo luarocks make rockspecs/lua-llthreads2-compat-scm-0.rockspec 43 - sudo luarocks make rockspecs/lua-llthreads2-compat-scm-0.rockspec
44 - sudo luarocks make rockspecs/lua-llthreads2-scm-0.rockspec
44 45
45script: 46script:
46 - cd test 47 - cd test
@@ -53,6 +54,7 @@ script:
53 - lua$LUA_SFX test_register_ffi.lua 54 - lua$LUA_SFX test_register_ffi.lua
54 - lua$LUA_SFX test_logger.lua 55 - lua$LUA_SFX test_logger.lua
55 - lua$LUA_SFX test_pass_cfunction.lua 56 - lua$LUA_SFX test_pass_cfunction.lua
57 - lua$LUA_SFX test_load_llthreads2.lua
56 58
57notifications: 59notifications:
58 email: 60 email:
diff --git a/README.md b/README.md
index 19bbb10..f84fdb2 100644
--- a/README.md
+++ b/README.md
@@ -33,14 +33,14 @@ llthread.set_logger(function(msg) LOG.error(msg) end)
33error("SOME ERROR") 33error("SOME ERROR")
34``` 34```
35 35
36### Start atached thread collectd in child thread 36### Start attached thread collectd in child thread
37``` Lua 37``` Lua
38-- This is main thread. 38-- This is main thread.
39local thread = require "llthreads".new[[ 39local thread = require "llthreads".new[[
40 require "utils".sleep(5) 40 require "utils".sleep(5)
41]] 41]]
42 42
43-- We tell that we start atached thread but child Lua State shuld be close in child thread. 43-- We tell that we start attached thread but child Lua State shuld be close in child thread.
44-- If `thread` became garbage in main thread then finallizer calls thread:join() 44-- If `thread` became garbage in main thread then finallizer calls thread:join()
45-- and main thread may hungup. 45-- and main thread may hungup.
46thread:start(false, false) 46thread:start(false, false)
@@ -51,14 +51,14 @@ thread:start(false, false)
51thread:join() 51thread:join()
52``` 52```
53 53
54### Start detached thread on which we can call join 54### Start detached joinable thread
55``` Lua 55``` Lua
56-- This is main thread. 56-- This is main thread.
57local thread = require "llthreads".new[[ 57local thread = require "llthreads".new[[
58 require "utils".sleep(5) 58 require "utils".sleep(5)
59]] 59]]
60 60
61-- We tell that we start detached joinable thread. In fact we start atached 61-- We tell that we start detached joinable thread. In fact we start attached
62-- thread but if `thread` became garbage in main thread then finallizer just 62-- thread but if `thread` became garbage in main thread then finallizer just
63-- detach child thread and main thread may not hungup. 63-- detach child thread and main thread may not hungup.
64thread:start(true, true) 64thread:start(true, true)
diff --git a/test/test_load_llthreads2.lua b/test/test_load_llthreads2.lua
new file mode 100644
index 0000000..11bf0a0
--- /dev/null
+++ b/test/test_load_llthreads2.lua
@@ -0,0 +1,7 @@
1local llthreads = require"llthreads2"
2
3llthreads.new([[
4 local os = require "os"
5 print("Done!")
6 os.exit(0)
7]]):start():join() \ No newline at end of file