LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop consumer loop after producer queue finished?


@Bob_Schor wrote:

Can we all agree that, no matter what the communication paradigm between Producer and Consumer, that communication must be maintained until the Consumer reads the last valid data sent by the Producer?  A "last element?" signal sent from Producer (who knows when it stops sending data) to the Consumer tells the Consumer when it can exit, and when it does, then both Consumer and Producer are finished communicating and the "pathway" can be abandoned/released/destroyed without generating "errors" or risking missing data.  There are many ways to do this, but something that flows along with the data seems (to me) to be the simplest and most fool-proof.

 

Bob Schor


Of course - the easiest way (using conventional queues) is to merge all the error wires coming out of the loops and put any queue destructions behind that.  Since dataflow says the merge error cannot execute until all its inputs are satisfied, it's an easy way to ensure everything is complete before you destroy stuff.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 11 of 13
(562 Views)

@altenbach wrote:

@Bob_Schor wrote:

Can we all agree that, no matter what the communication paradigm between Producer and Consumer, that communication must be maintained until the Consumer reads the last valid data sent by the Producer?


I actually disagree. The original requirement was to stop the consumer when the producer is done. It was not specified that all queued data needs to be processed. 🙂


You're right.  Though I imagine the OP probably does want the consumer to finish all queued elements even after the producer is done.

0 Kudos
Message 12 of 13
(558 Views)

@altenbach wrote:

@Bob_Schor wrote:

Can we all agree that, no matter what the communication paradigm between Producer and Consumer, that communication must be maintained until the Consumer reads the last valid data sent by the Producer?


I actually disagree. The original requirement was to stop the consumer when the producer is done. It was not specified that all queued data needs to be processed. 🙂


I have yet to run into an application where it was ok to drop data like that.  So I am 100% on board with Bob: some type of messaging needs to be done IN THE COMMUNICATION PATH that the producer sent its last data point and the consumer should then stop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 13 of 13
(547 Views)