[zeromq-dev] Polling API
mato at kotelna.sk
Thu Apr 15 17:52:43 CEST 2010
sustrik at 250bpm.com said:
> Here's a first sketch:
> // Account for both 0MQ sockets and file descriptors.
> union zmq_poll_item_t
> void *socket;
> int fd;
Why a union type? Will that not be potentially problematic for some
> // Construction & destruction.
> void *zmq_poller (void *context);
> int zmq_poller_close (void *poller);
zmq_pollset_init() seems more consistent (we have zmq_init(),
> // Pollset manipulation.
> int zmq_poller_mod (void *poller, zmq_poll_item_t item, int events, void
What is this "manipulation" call supposed to do? Shouldn't we have
zmq_pollset_add() and zmq_pollset_remove() instead?
> // Getting events.
> int zmq_poller_event (void *poller, zmq_poll_item_t *item, int *events,
> void **hint);
So, "Getting events" is the part that actually performs the poll operation?
Or is that missing here?
> Comments anyone?
> Maybe zmq_pollset would be more appropriate than zmq_poller?
I vote for zmq_pollset, definitely.
Incidentally we seem to be getting close to something similar to the APR
pollset API, which I have used in anger in the past and I've been pretty
happy with it.
For reference: http://apr.apache.org/docs/apr/1.4/group__apr__poll.html
More information about the zeromq-dev