LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue flushes on error

Solved!
Go to solution

To me this seems strange, but maybe I'm missing something. The when an error occurred the queue is flushed and can't be added two while the error persists. I've attached an example of this but I've been unable to find much information on this, whether it's by design or not.

 

My intent was not to clear the error code before adding elements to the queue and using the queue as part of the error handling process. But maybe that's a bad coding technique.

 

Advice appreciated.

0 Kudos
Message 1 of 6
(3,919 Views)
Solution
Accepted by topic author athing

What you're missing is a pretty common LabVIEW convention known as "standard error behavior".  The function does not run normally when there's a True error input.  This is mentioned in the detailed online help for the queue functions.  (Note: "Release Queue" is an exception, much like many "Close" functions for files, communication handles, etc.)

 

In many, maybe most cases, the function will be mostly a no-op.  Error in will be passed through to error out, but most other outputs will typically be the default value for their datatype.  That's why you got a 0 back from your Queue status check -- because it's the default value for integers, *not* because the queue was actually empty.   You could have made another query check right after the first where you didn't wire any error in, and you've have gotten a 1 back again.  And the Dequeue would also work if you didn't wire it with an error in.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 6
(3,898 Views)

@athing wrote:

To me this seems strange, but maybe I'm missing something. The when an error occurred the queue is flushed and can't be added two while the error persists. I've attached an example of this but I've been unable to find much information on this, whether it's by design or not.

 

My intent was not to clear the error code before adding elements to the queue and using the queue as part of the error handling process. But maybe that's a bad coding technique.

 

Advice appreciated.


How were you planning to use the queue as part of your error handling? That does make any sense.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 6
(3,893 Views)

Understood Kevin. Much appreciated.

 

-athing

0 Kudos
Message 4 of 6
(3,821 Views)

I'm assuming you meant "doesn't make sense."

 

The queue handles the program flow. I was interested in the program to take certain paths based on error, but not all of the errors being handled by the VI that had them.

 

Of course, it's a bit of an experiment. So, it may not be any good.

0 Kudos
Message 5 of 6
(3,817 Views)

It's fairly common to send error to a queue for error handling, but you need to make sure it doesn't propagate to the enqueue function or nothing will happen. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 6 of 6
(3,803 Views)