[zeromq-dev] zmq_poll loop break; performance
Daniel Krikun
krikun.daniel at gmail.com
Tue May 1 11:51:44 CEST 2012
Hello,
I have the following code to dispatch incoming messages via inproc
transport in one thread, and to stop the dispatcher from another (main)
thread:
void dispatch()
{
zmq::socket_t control_socket_ ( _global_context, ZMQ_PAIR );
control_socket_ .connect( "inproc://control" );
zmq::pollitem_t items[] = {
{ data_socket_, 0, ZMQ_POLLIN, 0 },
{ control_socket_, 0 , ZMQ_POLLIN, 0 }
};
while(1)
{
zmq::poll( items, 2)
if(items[0].revents & ZMQ_POLLIN)
{
// ... dispatch incoming messages ..
}
if(items[1].revents & ZMQ_POLLIN)
break;
}
}
In another (main) thread, I send an empty message to "inpoc://control" when
I want to stop the dispatch.
The problem that this stopping is somehow very slow.
Why could be that?
I am using zeromq-2.1.11 on Windows XP SP3, Visual Studio 2008.
Thanks,
--
Daniel Krikun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120501/a5ac82bd/attachment.htm>
More information about the zeromq-dev
mailing list