summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authormoteus <mimir@newmail.ru>2013-12-26 19:00:36 +0400
committermoteus <mimir@newmail.ru>2013-12-26 19:00:36 +0400
commitd19ff5561a442e18953130e0f21ac97b9bac4618 (patch)
treeb9fd01ca95c6ef336b706f41938a65f54dd1f7eb /README.md
parente3fe5123a36643634e00de6a1bb940e6e1febade (diff)
downloadlua-llthreads2-d19ff5561a442e18953130e0f21ac97b9bac4618.tar.gz
lua-llthreads2-d19ff5561a442e18953130e0f21ac97b9bac4618.tar.bz2
lua-llthreads2-d19ff5561a442e18953130e0f21ac97b9bac4618.zip
Update README.md [ci skip]
Diffstat (limited to 'README.md')
-rw-r--r--README.md22
1 files changed, 8 insertions, 14 deletions
diff --git a/README.md b/README.md
index a5dc46e..1b9dea6 100644
--- a/README.md
+++ b/README.md
@@ -41,32 +41,26 @@ local thread = require "llthreads".new[[
41 require "utils".sleep(5) 41 require "utils".sleep(5)
42]] 42]]
43 43
44-- We tell that we start atached thread 44-- We tell that we start atached thread but child Lua State shuld be close in child thread.
45-- but child Lua State shuld be close 45-- So thread:join() can not return any Lua values.
46-- in child thread. 46-- If `thread` became garbage in main thread then finallizer calls thread:join()
47-- So thread:join() can not return any values. 47-- and main thread may hungup.
48-- If `thread` became garbage in main thread then
49-- finallizer calls thread:join() and main thread
50-- may hungup.
51thread:start(false, false) 48thread:start(false, false)
52 49
53-- we can call join 50-- we can call join
54thread:join() 51thread:join()
55``` 52```
56 53
57### Start detached thread collectd on which we can call join 54### Start detached thread on which we can call join
58``` Lua 55``` Lua
59-- This is main thread. 56-- This is main thread.
60local thread = require "llthreads".new[[ 57local thread = require "llthreads".new[[
61 require "utils".sleep(5) 58 require "utils".sleep(5)
62]] 59]]
63 60
64-- We tell that we start detached thread 61-- We tell that we start detached thread but with ability call thread:join() and
65-- but with ability call thread:join() 62-- gets lua return values from child thread. In fact we start atached thread but if `thread`
66-- and gets lua return values from child thread. 63-- became garbage in main thread then finallizer just detach child thread and main thread
67-- In fact we start atached thread but if `thread`
68-- became garbage in main thread then finallizer
69-- just detach child thread and main thread
70-- may not hungup. 64-- may not hungup.
71thread:start(true, true) 65thread:start(true, true)
72 66