From e9e03f5ade3808f41ce5e53079bcecfd724b4610 Mon Sep 17 00:00:00 2001 From: Maxim Yakhontov Date: Fri, 18 Sep 2015 20:48:08 +0600 Subject: [PATCH] fixed zmq assertion in signaler.cpp under ubuntu --- src/signaler.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/signaler.cpp b/src/signaler.cpp index d9f1684e..008e6548 100644 --- a/src/signaler.cpp +++ b/src/signaler.cpp @@ -289,18 +289,23 @@ void zmq::signaler_t::recv () #if defined ZMQ_HAVE_EVENTFD uint64_t dummy; ssize_t sz = read (r, &dummy, sizeof (dummy)); - errno_assert (sz == sizeof (dummy)); - - // If we accidentally grabbed the next signal(s) along with the current - // one, return it back to the eventfd object. - if (unlikely (dummy > 1)) { - const uint64_t inc = dummy - 1; - ssize_t sz2 = write (w, &inc, sizeof (inc)); - errno_assert (sz2 == sizeof (inc)); - return; + if (sz == -1) { + errno_assert (errno == EAGAIN); } + else { + errno_assert (sz == sizeof (dummy)); - zmq_assert (dummy == 1); + // If we accidentally grabbed the next signal(s) along with the current + // one, return it back to the eventfd object. + if (unlikely (dummy > 1)) { + const uint64_t inc = dummy - 1; + ssize_t sz2 = write (w, &inc, sizeof (inc)); + errno_assert (sz2 == sizeof (inc)); + return; + } + + zmq_assert (dummy == 1); + } #else unsigned char dummy; #if defined ZMQ_HAVE_WINDOWS