[zeromq-dev] zmq_poll not working on Windows
Marko.Dieckmann at gmx.de
Marko.Dieckmann at gmx.de
Tue Oct 4 17:12:41 CEST 2011
Hello everyone,
I tried to make zmq_poll work in my zmq 2.1.9 sample application for Windows 7 (x64), but without success.
For this test I have a PUB/SUB setup between 2 threads.
// open INPROC socket to communicate with main thread
m_pInprocSocket = new zmq::socket_t(m_pZMQContext, ZMQ_SUB);
m_pInprocSocket->connect("inproc://thread_com");
m_pInprocSocket->setsockopt(ZMQ_SUBSCRIBE, "", 0);
Then in thread that opened the SUB socket I want to poll, like:
zmq_pollitem_t pi[] = { m_pInprocSocket, 0, ZMQ_POLLIN, 0 };
zmq_poll(pi, 1, -1);
// check INPROC socket
if (pi[0].revents & ZMQ_POLLIN)
{ ... etc }
Now, with zmq_poll the ZMQ_POLLIN event is never triggered, but I receive the messages, when I just use recv without polling.
After stepping into zmq_poll, it seems to be that this is the line where it exits:
// Build the fd_sets for passing to select ().
for (int i = 0; i != nitems_; i++) {
// If the poll item is a 0MQ socket we are interested in input on the
// notification file descriptor retrieved by the ZMQ_FD socket option.
if (items_ [i].socket) {
size_t zmq_fd_size = sizeof (zmq::fd_t);
zmq::fd_t notify_fd;
if (zmq_getsockopt (items_ [i].socket, ZMQ_FD, ¬ify_fd,
&zmq_fd_size) == -1)
return -1;
Does anybody have a tip what this could be?
Cheers,
Marko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111004/8a984c38/attachment.htm>
More information about the zeromq-dev
mailing list