3 ms·
To make 0MQ work with libev, get the file descriptor for each 0MQ socket: zmq_getsockopt(socket, ZMQ_FD, ¬ify_fd, ¬ify_fd_size) Then just pass notif
by pjscott 16y ago
To make 0MQ work with libev, get the file descriptor for each 0MQ socket:
zmq_getsockopt(socket, ZMQ_FD, ¬ify_fd, ¬ify_fd_size)
Then just pass notify_fd to libev, or libevent, or epoll, or whatever event library you prefer. Very pleasant and easy, but not yet officially documented last time I checked.
- jrockway 16y agoThis is not guaranteed to work. There is internal buffering and readabilty/writability is unrelated to the readability/writability of the underlying fd. You have to get ZMQ_EVENTS, check that readability/writability does not exist, and then make an IO watcher on the underlying fd. IIRC, you can't do this in pre-2.1.0 ZMQ; hence, using your own event loop is experimental. (I suppose it is also possible to see if you get EWOULDBLOCK during an IO operation, and then create the IO watcher, regular-socket-style.)