Commit abb184a0 authored by Martin Sustrik's avatar Martin Sustrik

ZMQ_NOBLOCK renamed ZMQ_DONTWAIT

Done because of POSIX compliance
Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent bc4a1ce3
...@@ -21,7 +21,7 @@ If there are no messages available on the specified 'socket' the _zmq_recv()_ ...@@ -21,7 +21,7 @@ If there are no messages available on the specified 'socket' the _zmq_recv()_
function shall block until the request can be satisfied. The 'flags' argument function shall block until the request can be satisfied. The 'flags' argument
is a combination of the flags defined below: is a combination of the flags defined below:
*ZMQ_NOBLOCK*:: *ZMQ_DONTWAIT*::
Specifies that the operation should be performed in non-blocking mode. If there Specifies that the operation should be performed in non-blocking mode. If there
are no messages available on the specified 'socket', the _zmq_recv()_ function are no messages available on the specified 'socket', the _zmq_recv()_ function
shall fail with 'errno' set to EAGAIN. shall fail with 'errno' set to EAGAIN.
......
...@@ -18,7 +18,7 @@ The _zmq_send()_ function shall queue the message referenced by the 'msg' ...@@ -18,7 +18,7 @@ The _zmq_send()_ function shall queue the message referenced by the 'msg'
argument to be sent to the socket referenced by the 'socket' argument. The argument to be sent to the socket referenced by the 'socket' argument. The
'flags' argument is a combination of the flags defined below: 'flags' argument is a combination of the flags defined below:
*ZMQ_NOBLOCK*:: *ZMQ_DONTWAIT*::
Specifies that the operation should be performed in non-blocking mode. If the Specifies that the operation should be performed in non-blocking mode. If the
message cannot be queued on the 'socket', the _zmq_send()_ function shall fail message cannot be queued on the 'socket', the _zmq_send()_ function shall fail
with 'errno' set to EAGAIN. with 'errno' set to EAGAIN.
......
...@@ -204,7 +204,7 @@ ZMQ_EXPORT int zmq_term (void *context); ...@@ -204,7 +204,7 @@ ZMQ_EXPORT int zmq_term (void *context);
#define ZMQ_RCVHWM 24 #define ZMQ_RCVHWM 24
/* Send/recv options. */ /* Send/recv options. */
#define ZMQ_NOBLOCK 1 #define ZMQ_DONTWAIT 1
#define ZMQ_SNDMORE 2 #define ZMQ_SNDMORE 2
ZMQ_EXPORT void *zmq_socket (void *context, int type); ZMQ_EXPORT void *zmq_socket (void *context, int type);
......
...@@ -478,7 +478,7 @@ int zmq::socket_base_t::send (::zmq_msg_t *msg_, int flags_) ...@@ -478,7 +478,7 @@ int zmq::socket_base_t::send (::zmq_msg_t *msg_, int flags_)
// In case of non-blocking send we'll simply propagate // In case of non-blocking send we'll simply propagate
// the error - including EAGAIN - upwards. // the error - including EAGAIN - upwards.
if (flags_ & ZMQ_NOBLOCK) if (flags_ & ZMQ_DONTWAIT)
return -1; return -1;
// Oops, we couldn't send the message. Wait for the next // Oops, we couldn't send the message. Wait for the next
...@@ -533,7 +533,7 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_) ...@@ -533,7 +533,7 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
// For non-blocking recv, commands are processed in case there's an // For non-blocking recv, commands are processed in case there's an
// activate_reader command already waiting int a command pipe. // activate_reader command already waiting int a command pipe.
// If it's not, return EAGAIN. // If it's not, return EAGAIN.
if (flags_ & ZMQ_NOBLOCK) { if (flags_ & ZMQ_DONTWAIT) {
if (errno != EAGAIN) if (errno != EAGAIN)
return -1; return -1;
if (unlikely (process_commands (false, false) != 0)) if (unlikely (process_commands (false, false) != 0))
......
...@@ -119,7 +119,7 @@ int zmq::xsub_t::xrecv (zmq_msg_t *msg_, int flags_) ...@@ -119,7 +119,7 @@ int zmq::xsub_t::xrecv (zmq_msg_t *msg_, int flags_)
// Message doesn't match. Pop any remaining parts of the message // Message doesn't match. Pop any remaining parts of the message
// from the pipe. // from the pipe.
while (msg_->flags & ZMQ_MSG_MORE) { while (msg_->flags & ZMQ_MSG_MORE) {
rc = fq.recv (msg_, ZMQ_NOBLOCK); rc = fq.recv (msg_, ZMQ_DONTWAIT);
zmq_assert (rc == 0); zmq_assert (rc == 0);
} }
} }
...@@ -141,7 +141,7 @@ bool zmq::xsub_t::xhas_in () ...@@ -141,7 +141,7 @@ bool zmq::xsub_t::xhas_in ()
while (true) { while (true) {
// Get a message using fair queueing algorithm. // Get a message using fair queueing algorithm.
int rc = fq.recv (&message, ZMQ_NOBLOCK); int rc = fq.recv (&message, ZMQ_DONTWAIT);
// If there's no message available, return immediately. // If there's no message available, return immediately.
// The same when error occurs. // The same when error occurs.
...@@ -159,7 +159,7 @@ bool zmq::xsub_t::xhas_in () ...@@ -159,7 +159,7 @@ bool zmq::xsub_t::xhas_in ()
// Message doesn't match. Pop any remaining parts of the message // Message doesn't match. Pop any remaining parts of the message
// from the pipe. // from the pipe.
while (message.flags & ZMQ_MSG_MORE) { while (message.flags & ZMQ_MSG_MORE) {
rc = fq.recv (&message, ZMQ_NOBLOCK); rc = fq.recv (&message, ZMQ_DONTWAIT);
zmq_assert (rc == 0); zmq_assert (rc == 0);
} }
} }
......
...@@ -48,7 +48,7 @@ int main (int argc, char *argv []) ...@@ -48,7 +48,7 @@ int main (int argc, char *argv [])
// Try to send 10 messages. Only 4 should succeed. // Try to send 10 messages. Only 4 should succeed.
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
int rc = zmq_send (sc, NULL, 0, ZMQ_NOBLOCK); int rc = zmq_send (sc, NULL, 0, ZMQ_DONTWAIT);
if (i < 4) if (i < 4)
assert (rc == 0); assert (rc == 0);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment