diff options
author | Martin Lucina <martin@lucina.net> | 2012-01-23 08:54:14 +0100 |
---|---|---|
committer | Martin Lucina <martin@lucina.net> | 2012-01-23 08:54:14 +0100 |
commit | 75af6aed482ab16997c1388fe801f74d11ec12a4 (patch) | |
tree | 637249631acc81446f6b5c2e25223f3164e132f6 /src/zmq.cpp | |
parent | b593ea30833ad5dcacb9076c988aec31b0cf26ec (diff) |
Imported Upstream version 2.1.9upstream/2.1.9
Diffstat (limited to 'src/zmq.cpp')
-rw-r--r-- | src/zmq.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp index 85f7d62..dce9630 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -412,7 +412,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) Sleep (timeout_ > 0 ? timeout_ / 1000 : INFINITE); return 0; #else - return usleep (timeout_); + usleep (timeout_); + return 0; #endif } @@ -565,7 +566,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) Sleep (timeout_ > 0 ? timeout_ / 1000 : INFINITE); return 0; #else - return usleep (timeout_); + usleep (timeout_); + return 0; #endif } @@ -649,13 +651,21 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) memcpy (&inset, &pollset_in, sizeof (fd_set)); memcpy (&outset, &pollset_out, sizeof (fd_set)); memcpy (&errset, &pollset_err, sizeof (fd_set)); - int rc = select (maxfd + 1, &inset, &outset, &errset, ptimeout); #if defined ZMQ_HAVE_WINDOWS - wsa_assert (rc != SOCKET_ERROR); + int rc = select (0, &inset, &outset, &errset, ptimeout); + if (unlikely (rc == SOCKET_ERROR)) { + zmq::wsa_error_to_errno (); + if (errno == ENOTSOCK) + return -1; + wsa_assert (false); + } #else - if (rc == -1 && errno == EINTR) - return -1; - errno_assert (rc >= 0); + int rc = select (maxfd + 1, &inset, &outset, &errset, ptimeout); + if (unlikely (rc == -1) { + if (errno == EINTR || errno == EBADF) + return -1; + errno_assert (false); + } #endif break; } |