[zeromq-dev] Questions

Martin Sustrik sustrik at fastmq.com
Fri Dec 12 16:44:29 CET 2008


I'm forwarding this to the mailing list so that others can join in.

To allow waiting for both 0MQ messages and an arbitrary file descriptor, 
it would be best IMO to add function to 0MQ API that would allow you to 
retrieve the file descriptor associated with 0MQ runtime. It will signal 
POLLIN every time there's are messages available from 0MQ. The user will 
be free to use the file descriptor any way he finds fit:

int zmq::api_thread_t::get_fd ();

When POLLIN is signaled on the file descriptor, you can call 
api_thread_t::receive and you will get the message.

Would that kind of interface work for you? Any other idea?


-------- Original Message --------
Subject: RE: [zeromq-dev] Questions
Date: Fri, 12 Dec 2008 12:55:42 +0100
From: Stam, Louis van der - Acision <louis.van.der.stam at acision.com>
To: 'Martin Sustrik' <sustrik at fastmq.com>

Hi Martin,

Thanks for your answer, I'll take a look at the code and see what I come 
up with. Meanwhile if you have any pointers...


-----Original Message-----
From: Martin Sustrik [mailto:sustrik at fastmq.com]
Sent: Friday, December 12, 2008 10:45 AM
To: Stam, Louis van der - Acision
Subject: Re: [zeromq-dev] Questions

Hi Louis,

> - Is there a limit to the number of queues a thread can receive messages from (or a process can have)?

No, there's no limit.

> - What do I need to do make it possible to, from one thread, wait for messages on a (or multiple) queues and wait for data on a socket of file filedescriptor?

This would require changing 0MQ code. If you look at the code you'll
notice there are objects called 'signalers' that are used to notify
other threads that messages have arrived. Currently, application threads
are notified via ultra-efficient 'ypollset' signaler that is based on
processor atomic operations rather than on file descriptors. To achieve
what you need, you'll have to use the file descriptor-based signaler
(ysocketpair). Then you'll have to modify the pollset to include
user-supplied file descriptors aside of those used internally by 0MQ.

If you want to mess with the code, I'll be happy to answer any question
you may have.


More information about the zeromq-dev mailing list