Commit a2500ae3 authored by Chia-liang Kao's avatar Chia-liang Kao Committed by Martin Sustrik

Fix a bug that zmq_poll's select backend spins when timeout=-1, due to

ptimeout not properly recalculated after first pass.
Signed-off-by: 's avatarChia-liang Kao <clkao@clkao.org>
parent 8abe6735
...@@ -8,6 +8,7 @@ Bernd Prager <bernd@prager.ws> ...@@ -8,6 +8,7 @@ Bernd Prager <bernd@prager.ws>
Bernd Melchers <melchers@ZEDAT.FU-Berlin.DE> Bernd Melchers <melchers@ZEDAT.FU-Berlin.DE>
Brian Buchanan <bwb@holo.org> Brian Buchanan <bwb@holo.org>
Burak Arslan <burak-github@arskom.com.tr> Burak Arslan <burak-github@arskom.com.tr>
Chia-liang Kao <clkao@clkao.org>
Chris Wong <chris@chriswongstudio.com> Chris Wong <chris@chriswongstudio.com>
Christian Gudrian <christian.gudrian@fluidon.com> Christian Gudrian <christian.gudrian@fluidon.com>
Conrad D. Steenberg <conrad.steenberg@caltech.edu> Conrad D. Steenberg <conrad.steenberg@caltech.edu>
......
...@@ -545,6 +545,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -545,6 +545,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
int nevents = 0; int nevents = 0;
fd_set inset, outset, errset; fd_set inset, outset, errset;
while (true) {
// Compute the timeout for the subsequent poll. // Compute the timeout for the subsequent poll.
timeval timeout; timeval timeout;
timeval *ptimeout; timeval *ptimeout;
...@@ -561,8 +563,6 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -561,8 +563,6 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
ptimeout = &timeout; ptimeout = &timeout;
} }
while (true) {
// Wait for events. Ignore interrupts if there's infinite timeout. // Wait for events. Ignore interrupts if there's infinite timeout.
while (true) { while (true) {
memcpy (&inset, &pollset_in, sizeof (fd_set)); memcpy (&inset, &pollset_in, sizeof (fd_set));
......
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