[zeromq-dev] missing events ZMQ_FD / ZMQ_EVENTS
Paul Colomiets
paul at colomiets.name
Fri Apr 27 11:57:30 CEST 2012
Hi Gerhard,
On Fri, Apr 27, 2012 at 12:37 PM, Gerhard Lipp <gelipp at googlemail.com> wrote:
> I don't think it is a docu thing.
>
> What the docu says (and what the source looks like)
> zmq_getsockopt(ZMQ_FD) returns a fd (the mailbox's), which becomes
> readable, whenever the corresponding socket might have become readable
> and/or writeable for operation with the NOBLOCK option. To check which
> of these conditions are true, you have to use
> zmq_getsockopt(ZMQ_EVENTS) and check for ZMQ_POLLIN / ZMQ_POLLOUT
> respectively.
>
This is totally true. The but it's silent on some things.
> If this is true, users should ONLY select/poll for the read event,
> e.g. using libev EV_READ, regardless if the user wants to
> zmq_recv(ZMQ_NOBLOCK) or zmq_send(ZMQ_NOBLOCK).
Yes. Only for EV_READ. I don't know how lua works with
libev so I've made an ill advice, sorry. (see below)
>
> I guess the "solution/workaround" of the example (using ev.READ +
> ev.WRITE) does not work reliable and under all circumstances, but just
> in this primitive scenario.
>
Adding ev.WRITE helps only because socket is *always* ready
for writing. So you are in a tight loop actually. The real missing
part of documentation is here.
https://github.com/zeromq/libzmq/pull/328/files
--
Paul
More information about the zeromq-dev
mailing list