Please see my previous post, add a third socket to the invocation of the streamer, wait for something to be sent to that socket, then exit...
On Jul 2, 2010, at 4:42 PM, Jarred Ward wrote: > > The zmq_device method, or rather the associated forwarder, queue, > etc object constructors, will never return at the moment; you're > forced to kill the process that is running it in order to stop. I > think it would be nice to be able to stop them somehow. Right now, I > don't use zmq_device for that reason; I use my own forwarder code > that I can "break" when I need to. > > I suggest contributing your code as a patch. If it's agreeable to > Martin, et al. then everyone will benefit after the patch merge. > > I would, but my forwarder code is not actually a change to the zmq > code-base. It's a completely separate forwarder that lives within an > application I'm writing. > > There are a couple ways I see to stop a device: > > - if the device is active a flag could be set from another thread to > break the device loop > - if the the device is blocking at the moment it has to be stopped > from another thread via a device specific term that doesn't tear > down the context > > Right now I use a combination of the two in my forwarder, but I'm > forced to deal with a complete tear down of the context with my > method. Here's the pseudocode: > > The forwarder is essentially this: > > while (running) forward_messages > > And kill by doing this: > > running = false; > zmq_term (ctx); > > Again the drawback of this solution is that I have to rebuild the > context to stop the device. > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
