[zeromq-dev] dev_poll
Michael P. McCormick
mccormick.michael.p at gmail.com
Tue May 11 20:09:51 CEST 2010
At first glance, I would recommend a feature such as this, specifically
for integrating with other third-party, open-source libraries ... one
scenario that comes to mind immediately might be a QuickFIX to ZMQ
gateway (or vice versa). Not 100% certain, but offhand, I think this
feature would be useful in that context.
On 05/11/2010 07:09 AM, Serge Aleynikov wrote:
> Hi,
>
> The current design of zmq_poll(3) call assumes the "ownership" of a the
> event objects such that it'll make the underlying poll call on the
> number of event objects (i.e. file descriptors or zmq sockets) and block
> for a specified timeout.
>
> When integrating this library with other libraries (such as Erlang VM),
> they may have their own event loop and facility to add/remove file
> descriptors along with providing a callback indicating that there's
> activity on given file descriptors.
>
> I'd like to see if the following requirement sounds reasonable.
>
> Objective
> ---------
> Allow external event loops control ZMQ communications layer.
>
>
> Implementation
> --------------
> Add two new functions:
>
> int zmq_poll_prepare(pollfd* fds_, zmq_pollitem_t *items_, int nitems_,
> int* zmq_signaler_fd_);
> Initialize the fds_ array of size nitems_ with file
> descriptors from items_. If there are ZMQ sockets in the items_
> array, *zmq_signaler_fd_ will contain the index of the ZMQ signaling
> fd. Otherwise *zmq_signaler_fd_ will be set to -1.
>
> int zmq_poll_check(pollfd* fd_, zmq_pollitem_t* item_, int event_,
> short type_)
> This function needs to be called after externally detected activity
> on event_. fd_ and item_ is the pollfd and zmq_pollitem_t structs
> corresponding to event_ item.
> The function will process internal ZMQ commands and update
> item_->revents corresponding to the type_ of event detected.
>
> I'd like to hear your feedback and can provide the implementation if
> there's interest of including it in the library.
>
> Serge
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
More information about the zeromq-dev
mailing list