[zeromq-dev] Hint/Example to use zmq socket in an asynchronous loop like epoll?
Martin Sustrik
sustrik at 250bpm.com
Thu Jan 21 21:30:26 CET 2010
Jianhua Cao wrote:
> Isn't zmq_poll the zmq centric way in the sense that the even loop has
> to be built with zmq_poll to block?
> I am thinking to integrate zmq (played as client role) to an existing
> async web frame work like tornado.
> One way I was thinking is to extract fd from zmq socket object. But that
> seems to be a wrong approach.
The problem is that a single 0MQ socket can handle thousands of
connections, each with its own fd. Moreover the polling logic is more
complex than just checking whether there's anything to read from the
socket (think of message queueing, message filtering etc.) Thus
"extracting the fd" approach won't work.
It certainly would be nice to have non-0MQ-centric way to do polling,
like using 0MQ socket handles directly by select/poll/epoll functions,
unfortunately, POSIX doesn't define any hook-up point for polling.
Yes, eventfd is getting close, but it's Linux-specific and it still
lacks ability to signal bot IN and OUT simultaneously.
Martin
More information about the zeromq-dev
mailing list