Hi,

diff --git a/src/ctx.cpp b/src/ctx.cpp
index 2660e1f..267f7d0 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -64,7 +64,8 @@ zmq::ctx_t::ctx_t (uint32_t io_threads_) :
     }

     //  In the unused part of the slot array, create a list of empty slots.
-    for (uint32_t i = slot_count - 1; i >= io_threads_; i--) {
+    for (int32_t i = (int32_t) slot_count - 1;
+          i >= (int32_t) io_threads_; i--) {
         empty_slots.push_back (i);
         slots [i] = NULL;
     }

Is there a special reason to count down from slot_count - 1?
Why not count up from io_threads to i < slot_count?
I posted attached patch few days back but it didn't make it.


Dhammika


On Thu, Sep 9, 2010 at 1:04 AM, Martin Sustrik <[email protected]> wrote:
> Sorry, here's the patch...
>
> On 9/9/2010, "Martin Sustrik" <[email protected]> wrote:
>
>>
>>Hi all,
>>
>>To make the contribution process completely deterministic, I am going to
>>post my patches on the mailing list in the same way as everybody else
>>does. Although I'll merge them myself, it still makes the license they
>>are contributed under clear and opens space for peer review.
>>
>>Here's a small patch that returns an error (EMTHREAD) from zmq_bind and
>>zmq_connect is these require I/O operations and no I/O thread is
>>available, i.e. zmq_init was called with parameter of zero.
>>
>>The patch is licensed under MIT/X11 license.
>>
>>Martin
>>_______________________________________________
>>zeromq-dev mailing list
>>[email protected]
>>http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
From 38eef77c3015cf4de741650fe8a0a155193bbc26 Mon Sep 17 00:00:00 2001
From: dhammika <[email protected]>
Date: Mon, 6 Sep 2010 19:32:31 -0700
Subject: [PATCH] fix zmq_context constructor with 0 io_threads


Signed-off-by: dhammika <[email protected]>
---
 src/ctx.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/ctx.cpp b/src/ctx.cpp
index 65c5316..ec8a045 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -64,7 +64,7 @@ zmq::ctx_t::ctx_t (uint32_t io_threads_) :
     }
 
     //  In the unused part of the slot array, create a list of empty slots.
-    for (uint32_t i = slot_count - 1; i >= io_threads_; i--) {
+    for (uint32_t i = io_threads_; i < slot_count; i++) {
         empty_slots.push_back (i);
         slots [i] = NULL;
     }
-- 
1.7.0.4

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

Reply via email to