05-26-2016 07:33 AM
How do you stop a que running in a sub vi? Please an example would be great.
I have a Que and it runs as a sub vi. The only problem is stopping it do I can do something else.
I have been told you need a refnum but I am unclear on how to make this actually work.
Please help.
Examples of how to do this would be great.
05-26-2016 07:44 AM
Please provide your code so we can look at it. Depending on your code and how you're handling the queue will determine how you can stop it.
05-26-2016 08:11 AM
I cant post the code company propriitary.
i am just looking for a way to stop a queue from outside a sub vi.
05-26-2016 08:22 AM
Hi,
Could you close it in the other part of the code where you use it and then just handle the error in the subVI?
Best regards,
05-26-2016 08:36 AM
If I am understanding properly, what you actually mean is how to stop a loop that is using a queue. What I like to do is send a "stop" command of some sort through the queue. The code in the subVI recieves the command via the Dequeue and stops appropriately.
It would be helpful if you could strip down your code so that we can at least see your framework. Then we could give better advice.
05-26-2016 10:00 AM
Here is how to kill your queue within a Producer/Consumer loop Sub VI.
Note: The Sub VI must be re-entrant
If it's a state machine queue then just enqueue an End function and within that case, exit the State Machine and then kill the queue. The point is, you need your "Dequeue Element" to read the "End" function, regardless of your architecture, and then handle it properly.