Hi Phillip, Steven, Marc,

The assert happens at src\ctx.cpp:148, through the zmq_term() function.

The performance testing throughput and latency programs all throw the
same assert.

See the patch attached.

Let me know whether it solves the problem.

Martin
>From fa30bc8d7d4ecf260050fac2fb70f779fa0ed23a Mon Sep 17 00:00:00 2001
From: Martin Sustrik <[email protected]>
Date: Mon, 18 Jul 2011 08:10:56 +0200
Subject: [PATCH] Signaler timeout bug on Windows fixed

Signed-off-by: Martin Sustrik <[email protected]>
---
 src/signaler.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/signaler.cpp b/src/signaler.cpp
index 8778d1a..4803f61 100644
--- a/src/signaler.cpp
+++ b/src/signaler.cpp
@@ -175,13 +175,17 @@ int zmq::signaler_t::wait (int timeout_)
     FD_ZERO (&fds);
     FD_SET (r, &fds);
     struct timeval timeout;
-    timeout.tv_sec = timeout_ / 1000;
-    timeout.tv_usec = timeout_ % 1000 * 1000;
+    if (timeout_ >= 0) {
+        timeout.tv_sec = timeout_ / 1000;
+        timeout.tv_usec = timeout_ % 1000 * 1000;
+    }
 #ifdef ZMQ_HAVE_WINDOWS
-    int rc = select (0, &fds, NULL, NULL, &timeout);
+    int rc = select (0, &fds, NULL, NULL,
+        timeout_ >= 0 ? &timeout : NULL);
     wsa_assert (rc != SOCKET_ERROR);
 #else
-    int rc = select (r + 1, &fds, NULL, NULL, &timeout);
+    int rc = select (r + 1, &fds, NULL, NULL,
+        timeout_ >= 0 ? &timeout : NULL);
     if (unlikely (rc < 0)) {
         zmq_assert (errno == EINTR);
         return -1;
-- 
1.6.5.1.1367.gcd48

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to