[zeromq-dev] 0MQ craching while polling in I/O thread

Dhammika Pathirana dhammika at gmail.com
Mon Mar 29 17:05:43 CEST 2010


Hi Martin,

But it's too confusing, why don't we do this in zmq_poll()?

    zmq::socket_t* sock1;

    items[ 0 ].socket = (void *)(*sock1);  /* correct */
    items[ 0 ].socket = (void *)sock1;     /* error */



On 3/29/10, Martin Sustrik <sustrik at 250bpm.com> wrote:
> Dhammika,
>
>
> > Think we're casting zmq::socket_t to zmq::socket_base_t in zmq_poll().
> > Patch attached.
> >
>
>  Yes. The point is that you should pass socket _handle_ to zmq_poll rather
> than pointer to zmq_socket_t object. The handle can be retrieved by casting
> zmq_socket_t to void*:
>
>  ...
>  socket_t s (ctx, ZMQ_P2P);
>  pollitem_t item;
>  item.socket = s;
>  ...
>
>  So it's user error. The documentation was modfied to make it clear.
>
>  Martin
>



More information about the zeromq-dev mailing list