LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop a que running in a sub vi

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.

 

0 Kudos
Message 1 of 6
(2,972 Views)

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.

CLD | CTD
0 Kudos
Message 2 of 6
(2,968 Views)

I cant post the code company propriitary.

i am just looking for a way to stop a queue from outside a sub vi.

 

0 Kudos
Message 3 of 6
(2,952 Views)

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,

Rares C.

0 Kudos
Message 4 of 6
(2,942 Views)

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.


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 5 of 6
(2,934 Views)

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. 

CLD | CTD
Download All
0 Kudos
Message 6 of 6
(2,914 Views)