[zeromq-dev] How to exit a blocking Receive call cleanly?
Matt Connolly
matt.connolly at me.com
Mon May 19 15:37:36 CEST 2014
You could also create another socket used solely for a Terminate message and do a zmq_poll on the two sockets. Then the loop would wake when there was work to do, or when it was time to quit.
http://api.zeromq.org/4-0:zmq-poll
Cheers,
Matt
On 19 May 2014, at 11:04 pm, Paulmichael Blasucci <pblasucci at gmail.com> wrote:
> Mark,
>
> Have you considered using a poll-based receive and periodically checking a CancellationToken? This approach has served me quite well in fszmq.
>
> Cheers.
>
> Paulmichael
>
>
> On Mon, May 19, 2014 at 3:33 AM, mark <manwoodvice at googlemail.com> wrote:
> I have a blocking Receive call that runs on a background thread for as long as the logical endpoint has not be stopped. The call to terminate an endpoint comes from a different thread, meaning the blocking Receive call throws some kind of exception - ObjectDisposed, SEH or AccessViolation.
>
> Is there a better pattern for this kind of setup? I'm using C# and clrzmq.
>
> Thanks
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140519/f7a9a2d3/attachment.htm>
More information about the zeromq-dev
mailing list