Allow zmq context to be nil. Fixed passing of timeout value to poller.

pull/10/head
Robert G. Jakabosky 15 years ago
parent eb96a2bc79
commit 9689b108b5

@ -54,7 +54,7 @@ end
function poller_mt:poll(timeout) function poller_mt:poll(timeout)
local poller = self.poller local poller = self.poller
local status, err = poller:poll(-1) local status, err = poller:poll(timeout)
if not status then if not status then
return false, err return false, err
end end

@ -47,7 +47,9 @@ local func
-- copy parent ZeroMQ context to this child thread. -- copy parent ZeroMQ context to this child thread.
local zmq = require"zmq" local zmq = require"zmq"
local zthreads = require"zmq.threads" local zthreads = require"zmq.threads"
zthreads.set_parent_ctx(zmq.init_ctx(parent_ctx)) if parent_ctx then
zthreads.set_parent_ctx(zmq.init_ctx(parent_ctx))
end
-- create global 'arg' -- create global 'arg'
arg = { select(4, ...) } arg = { select(4, ...) }
@ -69,7 +71,9 @@ return func(select(4, ...))
local function new_thread(ctx, action, action_arg, ...) local function new_thread(ctx, action, action_arg, ...)
-- convert ZMQ_Ctx to lightuserdata. -- convert ZMQ_Ctx to lightuserdata.
ctx = ctx:lightuserdata() if ctx then
ctx = ctx:lightuserdata()
end
local thread = llthreads.new(bootstrap_code, action, action_arg, ctx, ...) local thread = llthreads.new(bootstrap_code, action, action_arg, ctx, ...)
return setmetatable({ return setmetatable({
thread = thread, thread = thread,

Loading…
Cancel
Save