diff options
author | moteus <mimir@newmail.ru> | 2013-12-31 12:56:39 +0400 |
---|---|---|
committer | moteus <mimir@newmail.ru> | 2013-12-31 12:56:39 +0400 |
commit | 0b91ddda94b7b1d98036ac92b25dd8221f2fd661 (patch) | |
tree | a6398bdf867a08b2eabfbffe24562332716fa083 | |
parent | 1de7313ade8b0a6f6e3dc395eed5dd65c44a7829 (diff) | |
download | lua-llthreads2-0b91ddda94b7b1d98036ac92b25dd8221f2fd661.tar.gz lua-llthreads2-0b91ddda94b7b1d98036ac92b25dd8221f2fd661.tar.bz2 lua-llthreads2-0b91ddda94b7b1d98036ac92b25dd8221f2fd661.zip |
Update README [ci skip]
-rw-r--r-- | README.md | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -41,12 +41,13 @@ local thread = require "llthreads".new[[ | |||
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 atached thread but child Lua State shuld be close in child thread. |
44 | -- So thread:join() can not return any Lua values. | ||
45 | -- 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() |
46 | -- and main thread may hungup. | 45 | -- and main thread may hungup. |
47 | thread:start(false, false) | 46 | thread:start(false, false) |
48 | 47 | ||
49 | -- we can call join | 48 | -- We can call join. |
49 | -- Because of Lua state destroys in child thread we can not get | ||
50 | -- returned Lua vaules so we just returns `true`. | ||
50 | thread:join() | 51 | thread:join() |
51 | ``` | 52 | ``` |
52 | 53 | ||
@@ -57,13 +58,14 @@ local thread = require "llthreads".new[[ | |||
57 | require "utils".sleep(5) | 58 | require "utils".sleep(5) |
58 | ]] | 59 | ]] |
59 | 60 | ||
60 | -- We tell that we start detached thread but with ability call thread:join() and | 61 | -- We tell that we start detached joinable thread. In fact we start atached |
61 | -- gets lua return values from child thread. In fact we start atached thread but if `thread` | 62 | -- thread but if `thread` became garbage in main thread then finallizer just |
62 | -- became garbage in main thread then finallizer just detach child thread and main thread | 63 | -- detach child thread and main thread may not hungup. |
63 | -- may not hungup. | ||
64 | thread:start(true, true) | 64 | thread:start(true, true) |
65 | 65 | ||
66 | -- we can call join | 66 | -- We can call join. |
67 | -- Because of Lua state destroys in child thread we can not get | ||
68 | -- returned Lua vaules so we just returns `true`. | ||
67 | thread:join() | 69 | thread:join() |
68 | ``` | 70 | ``` |
69 | 71 | ||