diff options
author | 2016-02-14 08:16:35 +0100 | |
---|---|---|
committer | 2016-02-14 08:16:35 +0100 | |
commit | 2db49088141b6238e92aecc4c073076a02c73065 (patch) | |
tree | dba4ea354a0dec2d986fd49de943e5f30b81f8a1 /3rdparty/luv/examples/uvbook/queue-work.lua | |
parent | 80e8fe80e6354acc7157bd82066e719365642a1b (diff) |
Added lua-zlib, lfs and luv support for LUA, exposed all using luaengine (nw)
Diffstat (limited to '3rdparty/luv/examples/uvbook/queue-work.lua')
-rw-r--r-- | 3rdparty/luv/examples/uvbook/queue-work.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/3rdparty/luv/examples/uvbook/queue-work.lua b/3rdparty/luv/examples/uvbook/queue-work.lua new file mode 100644 index 00000000000..cf52abfb216 --- /dev/null +++ b/3rdparty/luv/examples/uvbook/queue-work.lua @@ -0,0 +1,19 @@ +local uv = require('luv') + +local ctx = uv.new_work( + function(n) --work,in threadpool + local uv = require('luv') + local t = uv.thread_self() + uv.sleep(100) + return n*n,n + end, + function(r,n) print(string.format('%d => %d',n,r)) end --after work, in loop thread +) +uv.queue_work(ctx,2) +uv.queue_work(ctx,4) +uv.queue_work(ctx,6) +uv.queue_work(ctx,8) +uv.queue_work(ctx,10) + +uv.run('default') +uv.loop_close() |