here is a stub:

    zmq_pollitem_t items[] = {
        { mtySock,        0,         ZMQ_POLLIN, 0 },  // moriarty    (req/rep 
socket)
        { pktSUB,         0,         ZMQ_POLLIN, 0 },  // raw packets (sub 
socket)
        { zyreStatusSock, 0,         ZMQ_POLLIN, 0 },  // zyre status (sub 
socket)
        { NULL,           inotifyFD, ZMQ_POLLIN, 0 }   // inotify     (unix 
file desc)
    };

    int npoll = sizeof(items) / sizeof(items[0]);
    int timeout = 1000;

    while(!zctx_interrupted) {

        ret = zmq_poll (items, npoll, timeout);
        if (ret == 0) {
            // timeout
        }
        if (ret < 0) {
            if(zctx_interrupted)
                syslog(LOG_INFO, "zmq_poll received interrupt - exiting.");
            break;
        }


        if (items[0].revents == ZMQ_POLLIN) {
           // handle REQ-REP
        }
        if (items[1].revents == ZMQ_POLLIN) { // handle pkts
            // get a packet
        }

and so on..

Sridhar

> On Nov 13, 2015, at 2:02 PM, Bruce Lane <[email protected]> wrote:
> 
> thank you Pieter, could you point me to the right sample for polling?
> 
> On 13 November 2015 at 16:58, Pieter Hintjens <[email protected]> wrote:
> You should poll the socket and only receive when there is input.
> 
> On Fri, Nov 13, 2015 at 2:06 PM, Bruce Lane <[email protected]> wrote:
> > hi,
> > I'm building this block https://github.com/brucelane/Cinder-ZeroMQ for the
> > Cinder C++ framework.
> >
> > what is the way to use a zeroMQ responder without the execution paused at
> > zmq_recv (responder, buffer, 10, 0)?
> > Shall I use a separate thread or there is another way, like something else
> > than a responder?
> >
> > Bruce
> >
> >
> > _______________________________________________
> > 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
> 
> _______________________________________________
> 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

Reply via email to