[zeromq-dev] zmq_recv documentation

Martin Sustrik sustrik at imatix.com
Wed Apr 28 08:58:58 CEST 2010


Varol,

> I was trying to get zmq_poll working but for some reason my app crashes
> event when I init the ctx with the ZMQ_POLL flag.
> 
> It'll crash inside zmq_poll at :
> pollfds [npollfds].fd = app_thread->get_signaler ()->get_fd ();
> for some reasons app_thread->get_signaler () is NULL.

Shouldn't happen. Do you have a test program?

> Anyhow, I just thought I drop a line wrt the zmq_recv documentation.
> 
> Looking at the *ZMQ_NOBLOCK *section it states
> Specifies that the operation should be performed in non-blocking mode.
> If there are no messages available to be dequeued from the underlying
> /message queue/ associated with /socket/, the /zmq_recv()/ function
> shall fail with /errno/ set to EAGAIN.
> 
> 
> So I was expecting the function to return -1, as stated a few lines
> further down
> *
> RETURN VALUE*
> The /zmq_recv()/ function shall return zero if successful. Otherwise it
> shall return -1 and set /errno/ to one of the values defined below.
> 
> However if no msg is available it'll return 0, else 1. ( on Linux )

What you are saying is that zmq_recv will return 0 even is message is 
not fetched, right? If so, do you have a test program?

> Smehow there seems to be a disconnect between those two.

Martin



More information about the zeromq-dev mailing list