diff options
author | moteus <mimir@newmail.ru> | 2013-12-31 13:11:28 +0400 |
---|---|---|
committer | moteus <mimir@newmail.ru> | 2013-12-31 13:11:28 +0400 |
commit | af2087987852b6250e7aaafd626e292893d43a7d (patch) | |
tree | f85ba1b7cfddea43d34afaa6140ca29b1ea1bc87 /README.md | |
parent | 0b91ddda94b7b1d98036ac92b25dd8221f2fd661 (diff) | |
download | lua-llthreads2-af2087987852b6250e7aaafd626e292893d43a7d.tar.gz lua-llthreads2-af2087987852b6250e7aaafd626e292893d43a7d.tar.bz2 lua-llthreads2-af2087987852b6250e7aaafd626e292893d43a7d.zip |
Add. test for lua-llthreas2 module.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -33,14 +33,14 @@ llthread.set_logger(function(msg) LOG.error(msg) end) | |||
33 | error("SOME ERROR") | 33 | error("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. |
39 | local thread = require "llthreads".new[[ | 39 | local 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. |
46 | thread:start(false, false) | 46 | thread:start(false, false) |
@@ -51,14 +51,14 @@ thread:start(false, false) | |||
51 | thread:join() | 51 | thread: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. |
57 | local thread = require "llthreads".new[[ | 57 | local 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. |
64 | thread:start(true, true) | 64 | thread:start(true, true) |