[zeromq-dev] czmq: zloop_poller for stdin - ambiguity

Michael Haberler mail17 at mah.priv.at
Thu Mar 13 21:09:45 CET 2014


trying to use zloop for reading with libreadline on stdin, while handling other events

this doesnt work because fd 0 is considered invalid in zloop.c:328 ; if I disable the check that works just fine

I see two ways to resolve the situation:

- consider a zmq_pollitem with socket=NULL and fd=0 as valid, to mean: poll on fd 0
- explicitly set an invalid fd to -1, which is an API change

I would prefer the first option - please advise

- Michael


int
zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg)
{
    assert (self);

    // suggestion: remove this test:
    if (!item->socket && !item->fd)
        return -1;


More information about the zeromq-dev mailing list