取消
显示结果 
搜索替代 
您的意思是: 

Queue flushes on error

已解决!
转到解答

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 项奖励
1 条消息(共 6 条)
3,960 次查看
解答
已被主题作者 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.
2 条消息(共 6 条)
3,939 次查看

@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 项奖励
3 条消息(共 6 条)
3,934 次查看

Understood Kevin. Much appreciated.

 

-athing

0 项奖励
4 条消息(共 6 条)
3,862 次查看

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 项奖励
5 条消息(共 6 条)
3,858 次查看

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
6 条消息(共 6 条)
3,844 次查看