Skip to content

Commit

Permalink
Merge pull request zeromq#469 from hurtonm/code_cleanup
Browse files Browse the repository at this point in the history
Minor code cleanup
  • Loading branch information
ianbarber committed Nov 13, 2012
2 parents c179ad1 + 9013ee0 commit 30eaadd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/epoll.cpp
Expand Up @@ -140,9 +140,10 @@ void zmq::epoll_t::loop ()
// Wait for events.
int n = epoll_wait (epoll_fd, &ev_buf [0], max_io_events,
timeout ? timeout : -1);
if (n == -1 && errno == EINTR)
if (n == -1) {
errno_assert (errno == EINTR);
continue;
errno_assert (n != -1);
}

for (int i = 0; i < n; i ++) {
poll_entry_t *pe = ((poll_entry_t*) ev_buf [i].data.ptr);
Expand Down
5 changes: 3 additions & 2 deletions src/kqueue.cpp
Expand Up @@ -163,9 +163,10 @@ void zmq::kqueue_t::loop ()
timespec ts = {timeout / 1000, (timeout % 1000) * 1000000};
int n = kevent (kqueue_fd, NULL, 0, &ev_buf [0], max_io_events,
timeout ? &ts: NULL);
if (n == -1 && errno == EINTR)
if (n == -1) {
errno_assert (errno == EINTR);
continue;
errno_assert (n != -1);
}

for (int i = 0; i < n; i ++) {
poll_entry_t *pe = (poll_entry_t*) ev_buf [i].udata;
Expand Down
6 changes: 3 additions & 3 deletions src/poll.cpp
Expand Up @@ -125,10 +125,10 @@ void zmq::poll_t::loop ()

// Wait for events.
int rc = poll (&pollset [0], pollset.size (), timeout ? timeout : -1);
if (rc == -1 && errno == EINTR)
if (rc == -1) {
errno_assert (errno == EINTR);
continue;
errno_assert (rc != -1);

}

// If there are no events (i.e. it's a timeout) there's no point
// in checking the pollset.
Expand Down
5 changes: 3 additions & 2 deletions src/select.cpp
Expand Up @@ -168,9 +168,10 @@ void zmq::select_t::loop ()
#else
int rc = select (maxfd + 1, &readfds, &writefds, &exceptfds,
timeout ? &tv : NULL);
if (rc == -1 && errno == EINTR)
if (rc == -1) {
errno_assert (errno == EINTR);
continue;
errno_assert (rc != -1);
}
#endif

// If there are no events (i.e. it's a timeout) there's no point
Expand Down

0 comments on commit 30eaadd

Please sign in to comment.