[zeromq-dev] Polling API

Brian Granger ellisonbg at gmail.com
Fri Apr 9 21:08:15 CEST 2010


On Fri, Apr 9, 2010 at 8:33 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> gonzalo diethelm wrote:
>> Ok, I'm about ready to commit a patch in this direction. But before I do
>> that, another question. I have just realized that Poller objects (and
>> the whole zmq_poll() functionality) do not depend on Context at all. In
>> other words, I could perfectly change the code to make this possible:
>>   ZMQ.Context c = ZMQ.context(1, 1, ZMQ.POLL); // new Context, same as
>> above
>>   ZMQ.Socket s = c.socket(ZMQ.PUB);            // new Socket, same as
>> above
>>   ZMQ.Poller p = ZMQ.poller(3);                // new Poller, NO CONTEXT
>> On the other hand, it may be useful to be able to get the current 0MQ
>> Context from a Socket and/or a Poller object (which would force us build
>> Pollers from a starting Context):
>>   ZMQ.Context c1 = socket.getContext();
>>   ZMQ.Context c2 = poller.getContext();
> Well, I would say that polling is ripe to get some standardised
> interface. Something like epoll/kqueue.
> There's one provided by Python binding, now there's Java, Lisp copies
> the C interface, not sure about PHP and other languages...
> Thoughts anyone?

For Python at least, I think it is very important to have an API that
is identical to the built-in poll.  This makes it quite easy to plug
pyzmq into existing python event loops.  We have already done this and
it is definitely a huge feature.  But I am not sure this makes sense
for other languages.



> Martin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com

More information about the zeromq-dev mailing list