[zeromq-dev] Breaking blocking in a server app

Matt Weinstein matt_weinstein at yahoo.com
Thu Jul 1 21:15:11 CEST 2010


One simple way might be to use an inproc: PUB/SUB socket:

	zmq::socket_t kill_me(*ctx, ZMQ_SUB);
	s.setsockopt(ZMQ_SUBSCRIBE, "", 0);

Service threads would then poll() both their normal socket and the  
"kill" socket.  As soon as a message arrived, the thread would cleanup  
and quit.

On Jun 30, 2010, at 9:05 PM, Brian Granger wrote:

>
>
> On Wed, Jun 30, 2010 at 5:27 PM, Matt Weinstein <matt_weinstein at yahoo.com 
> > wrote:
> Under what circumstances do you want to break blocking?
>
> E.g. timeout, connection failure, etc.?
>
>
>
> For us, we want to do this when we want to kill a process that is  
> sitting there blocking in zmq.recv.  IOW, we want SIGINT to trigger  
> the process to shutdown in a semi-clean manner (no seg faults!).
>
> Cheers,
>
> Brian
>
> On Jun 30, 2010, at 10:23 AM, Derek Developer wrote:
>
>> Is there any way to break the blocking of zmq_recv() without firing  
>> up a client and sending a message like "QUIT SERVER"?
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
>
> -- 
> Brian E. Granger, Ph.D.
> Assistant Professor of Physics
> Cal Poly State University, San Luis Obispo
> bgranger at calpoly.edu
> ellisonbg at gmail.com
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100701/072ec5a0/attachment.htm>


More information about the zeromq-dev mailing list