10-22-2021 04:38 PM
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.
Solved! Go to Solution.
10-22-2021 05:11 PM
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
10-22-2021 05:20 PM
@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.
10-25-2021 08:57 AM
Understood Kevin. Much appreciated.
-athing
10-25-2021 09:17 AM
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.
10-25-2021 10:29 AM
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. 🙂