On Fri, Sep 26, 2014 at 09:55:59AM +0200, Dorvin wrote:
> W dniu 2014-09-26 02:05, KIU Shueng Chuan pisze:
> > Your code could be stripped down a lot:
> > 1) PUB socket is only for sending. There's no need to test it for
> > ZMQ_POLLIN.
> > 2) PUB socket never blocks when sending. There's no need to test it for
> > ZMQ_POLLOUT.
> > 3) SUB socket is only for receiving. There's no need to test it for
> > ZMQ_POLLOUT.
> > 4) The ZMQ_FDs are only to be tested for readability. They are NOT to be
> > tested for writability (and in fact should always test positive for
> > writability.)
> >
> 
> You are right. My case isn't really "minimal" but allows to test on 
> different types of sockets with just minimal changes.
> 
> I still feel not right about receiving POLLIN on write but it might just 
> be my habit from old times of low level socket programming. You both 
> made me start to think about 0mq in different way.
> 
> 
> Thanks,
> Jarek

You aren't receiving POLLIN on write. You receive POLLIN on event,
whatever that may be. That's just how an eventfd works. There is no
way to make a FD emit a POLLOUT event like you can with a POLLIN.
Reading from an FD doesn't generate the event due to buffering.

Remember that a zmq socket has a fan in/out structure and the FD has
to signal all events for all lowlevel sockets:

       /---- socket 1
       |/--- socket 2
FD <---*---- socket 3
       |\--- socket 4
       \---- socket 5

MfG
        Goswin
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to