[zeromq-dev] zeromq2: problem with closing pollable socket
Martin Sustrik
sustrik at 250bpm.com
Thu Oct 29 15:35:08 CET 2009
Hi Vitaly,
>> ctx = zmq_init (1, 1, ZMQ_POLL);
>> s = zmq_socket();
>> rc = zmq_bind();
>> zmq_poll(..., ZMQ_POLLOUT);
>> zmq_send(..., ZMQ_NOBLOCK);
>> zmq_close(); <-- blocks here forever
>
> That's a bug. We'll have a look at it soon. Ticket ZMQII-22.
I've written a following test program... however, it doesn't seem to
block. Can you test it on your side and let me know whether it blocks?
If not so, can you post your test program that blocks?
Thanks.
Martin
#include <zmq.h>
#include <assert.h>
int main ()
{
int rc;
void *ctx;
void *s;
ctx = zmq_init (1, 1, ZMQ_POLL);
assert (ctx);
s = zmq_socket (ctx, ZMQ_PUB);
assert (s);
rc = zmq_bind (s, "tcp://lo:5555");
assert (rc == 0);
zmq_pollitem_t pi = {s, -1, ZMQ_POLLOUT, 0};
rc = zmq_poll (&pi, 1);
assert (rc == 1);
zmq_msg_t msg;
rc = zmq_msg_init_size (&msg, 10);
assert (rc == 0);
rc = zmq_send (s, &msg, ZMQ_NOBLOCK);
assert (rc == 0);
rc = zmq_close (s);
assert (rc == 0);
return 0;
}
More information about the zeromq-dev
mailing list