diff options
author | Alexey Melnichuk <mimir@newmail.ru> | 2014-06-23 09:40:31 +0500 |
---|---|---|
committer | Alexey Melnichuk <mimir@newmail.ru> | 2014-06-23 09:40:31 +0500 |
commit | 0c30fad3da0a8a3a53303b50fe45785ad4e1893d (patch) | |
tree | 98856e073699988462625c3501aa668de93b2d53 | |
parent | f0a6754cd15912de529b9662e3e08bfaadd6bf1e (diff) | |
parent | 2653b5c00746d41c836d75cb2bd110e994f9e235 (diff) | |
download | lua-llthreads2-0c30fad3da0a8a3a53303b50fe45785ad4e1893d.tar.gz lua-llthreads2-0c30fad3da0a8a3a53303b50fe45785ad4e1893d.tar.bz2 lua-llthreads2-0c30fad3da0a8a3a53303b50fe45785ad4e1893d.zip |
Merge branch 'master' of https://github.com/moteus/lua-llthreads2
-rw-r--r-- | README.md | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -20,6 +20,15 @@ This is full dropin replacement for [llthreads](https://github.com/Neopallium/lu | |||
20 | * thread:start() has additional parameter which control in which thread child Lua VM will be destroyed | 20 | * thread:start() has additional parameter which control in which thread child Lua VM will be destroyed |
21 | * allow pass cfunctions to child thread (e.g. to initialize Lua state) | 21 | * allow pass cfunctions to child thread (e.g. to initialize Lua state) |
22 | 22 | ||
23 | ##Thread start arguments | ||
24 | | default | `detached` | `joinable` | join returns | child state closes by | gc calls | detach on | | ||
25 | |:-------:|:--------:|:--------:|:------------:|:------------------:|:--------:|:---------:| | ||
26 | | | false | false | `true` | child | join | `<NEVER>` | | ||
27 | | * | false | true | Lua values | parent | join | `<NEVER>` | | ||
28 | | * | true | false | raise error | child | `<NONE>` | start | | ||
29 | | | true | true | `true` | child | detach | gc | | ||
30 | |||
31 | |||
23 | ##Usage | 32 | ##Usage |
24 | 33 | ||
25 | ### Use custom logger | 34 | ### Use custom logger |
@@ -45,7 +54,8 @@ local thread = require "llthreads".new[[ | |||
45 | 54 | ||
46 | -- We tell that we start attached thread but child Lua State shuld be close in child thread. | 55 | -- We tell that we start attached thread but child Lua State shuld be close in child thread. |
47 | -- If `thread` became garbage in main thread then finallizer calls thread:join() | 56 | -- If `thread` became garbage in main thread then finallizer calls thread:join() |
48 | -- and main thread may hungup. | 57 | -- and main thread may hungup. But because of child state closes in child thread all objects |
58 | -- in this state can be destroyed and we can prevent deadlock. | ||
49 | thread:start(false, false) | 59 | thread:start(false, false) |
50 | 60 | ||
51 | -- We can call join. | 61 | -- We can call join. |