From af2087987852b6250e7aaafd626e292893d43a7d Mon Sep 17 00:00:00 2001 From: moteus Date: Tue, 31 Dec 2013 13:11:28 +0400 Subject: Add. test for lua-llthreas2 module. --- .travis.yml | 2 ++ README.md | 8 ++++---- test/test_load_llthreads2.lua | 7 +++++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 test/test_load_llthreads2.lua diff --git a/.travis.yml b/.travis.yml index 95708f1..38b2ca6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,7 @@ before_install: install: - sudo luarocks install lunitx - sudo luarocks make rockspecs/lua-llthreads2-compat-scm-0.rockspec + - sudo luarocks make rockspecs/lua-llthreads2-scm-0.rockspec script: - cd test @@ -53,6 +54,7 @@ script: - lua$LUA_SFX test_register_ffi.lua - lua$LUA_SFX test_logger.lua - lua$LUA_SFX test_pass_cfunction.lua + - lua$LUA_SFX test_load_llthreads2.lua notifications: 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) error("SOME ERROR") ``` -### Start atached thread collectd in child thread +### Start attached thread collectd in child thread ``` Lua -- This is main thread. local thread = require "llthreads".new[[ require "utils".sleep(5) ]] --- We tell that we start atached thread but child Lua State shuld be close in child thread. +-- We tell that we start attached thread but child Lua State shuld be close in child thread. -- If `thread` became garbage in main thread then finallizer calls thread:join() -- and main thread may hungup. thread:start(false, false) @@ -51,14 +51,14 @@ thread:start(false, false) thread:join() ``` -### Start detached thread on which we can call join +### Start detached joinable thread ``` Lua -- This is main thread. local thread = require "llthreads".new[[ require "utils".sleep(5) ]] --- We tell that we start detached joinable thread. In fact we start atached +-- We tell that we start detached joinable thread. In fact we start attached -- thread but if `thread` became garbage in main thread then finallizer just -- detach child thread and main thread may not hungup. thread: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 @@ +local llthreads = require"llthreads2" + +llthreads.new([[ + local os = require "os" + print("Done!") + os.exit(0) +]]):start():join() \ No newline at end of file -- cgit v1.2.3-55-g6feb