The number of PollItem structures with events signalled in PollItem.returnedEvents, or 0 if no events have been signalled.
auto socket1 = zmqd.Socket(zmqd.SocketType.pull); socket1.bind("inproc://zmqd_poll_example"); import std.socket; auto socket2 = new std.socket.Socket( AddressFamily.INET, std.socket.SocketType.DGRAM); socket2.bind(new InternetAddress(InternetAddress.ADDR_ANY, 5678)); auto socket3 = zmqd.Socket(zmqd.SocketType.push); socket3.connect("inproc://zmqd_poll_example"); socket3.send("test"); import core.thread: Thread; Thread.sleep(10.msecs); auto items = [ PollItem(socket1, PollFlags.pollIn), PollItem(socket2, PollFlags.pollIn | PollFlags.pollOut), PollItem(socket3, PollFlags.pollIn), ]; const n = poll(items, 100.msecs); assert (n == 2); assert (items[0].returnedEvents == PollFlags.pollIn); assert (items[1].returnedEvents == PollFlags.pollOut); assert (items[2].returnedEvents == 0); socket2.close();
Input/output multiplexing.
The timeout parameter may have the special value infiniteDuration which means no _timeout. This is translated to an argument value of -1 in the C API.