diff --git a/AUTHORS b/AUTHORS index 6a7fe1da..bdb17a1e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -8,6 +8,7 @@ Bernd Prager Bernd Melchers Brian Buchanan Burak Arslan +Chia-liang Kao Chris Wong Christian Gudrian Conrad D. Steenberg diff --git a/src/zmq.cpp b/src/zmq.cpp index 82e98f66..c073f82d 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -545,24 +545,24 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) int nevents = 0; fd_set inset, outset, errset; - // Compute the timeout for the subsequent poll. - timeval timeout; - timeval *ptimeout; - if (first_pass) { - timeout.tv_sec = 0; - timeout.tv_usec = 0; - ptimeout = &timeout; - } - else if (timeout_ < 0) - ptimeout = NULL; - else { - timeout.tv_sec = (long) ((end - now) / 1000); - timeout.tv_usec = (long) ((end - now) % 1000 * 1000); - ptimeout = &timeout; - } - while (true) { + // Compute the timeout for the subsequent poll. + timeval timeout; + timeval *ptimeout; + if (first_pass) { + timeout.tv_sec = 0; + timeout.tv_usec = 0; + ptimeout = &timeout; + } + else if (timeout_ < 0) + ptimeout = NULL; + else { + timeout.tv_sec = (long) ((end - now) / 1000); + timeout.tv_usec = (long) ((end - now) % 1000 * 1000); + ptimeout = &timeout; + } + // Wait for events. Ignore interrupts if there's infinite timeout. while (true) { memcpy (&inset, &pollset_in, sizeof (fd_set));