Closed ghost closed 7 years ago
I've run your sample code under strace
, and I'm pretty sure that the issue is that the PollItem
constructed by PollItem::from_fd
has its events
field initialized to zero, which means it might as well not have been included in the call to zmq::poll
. With the current code, there is not even a way to set the events that one is interested in. My plan to address this is:
events
field of a PollItem
in the release/v0.8
branch.from_fd
in master (breaking API change, for symmetry with Socket::as_poll_item
).@zwb-ict Of course, pull requests welcome, if you feel inclined to hack at this right away. I'm off for today.
@rotty I prefer the second plan.
Add a second parameter for specifying the events to from_fd in master (breaking API change, for symmetry with Socket::as_poll_item).
It seems better.
Both are appropriate. It's fine to have a PollItem::set_events
in 0.8.x, and for 0.9, since it will break an API that never could have worked - which is a good thing, add the parameter PollItem::from_fd
.
I create a PollItem with a pipe RawFD (pipe.0). I write pipe.1 with a byte when SIGINT has been catched, the zmq::poll can return with 1 correctly everytime after the process recv SIGINT. But when I query PollItem's events, I get zero. No readable flag is set.