aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/README.md b/README.md
index 58e78eb..3d723da 100644
--- a/README.md
+++ b/README.md
@@ -119,5 +119,33 @@ end
119local ok, ret = thread:join() -- true, 1 119local ok, ret = thread:join() -- true, 1
120``` 120```
121 121
122### Use `ex` module
123``` Lua
124local Threads = require "llthreads.ex"
125
126local ok, v = Threads.new(function()
127 return 1
128end):start():join()
129assert(v == 1)
130
131local thread = Threads.new({
132 -- this is thread code gets changed arguments
133 function(a, b)
134 assert(1 == a)
135 assert(2 == b)
136 print("Done")
137 end;
138
139 -- prelude can change thread arguments
140 prelude = function(a, b)
141 assert("1" == a)
142 assert(nil == b)
143 return tonumber(a), 2
144 end;
145}, "1")
146
147thread:start():join()
148```
149
122[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/moteus/lua-llthreads2/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 150[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/moteus/lua-llthreads2/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
123 151