02-13-2018 06:54 PM
So, you're saying that, instead of queuing ALL 5 states at the same time, to just queue the first 3, then have the "3rd state case" set the queue to the next 2 cases? At this point, am I just using a shift register instead of the message handling VIs?
I know I might be asking a lot, but if you could, could you make a quick example VI? I'm not sure I'm making the same conclusions that you are.
Thanks Cross!
02-14-2018 05:58 AM - edited 02-14-2018 05:59 AM
Here is a snippet and VI saved in 8.0 that you can mess around with.
02-14-2018 06:53 PM
OK, it looks like I was understanding you correctly. Thanks for clarifying.
01-20-2021 06:24 PM
@crossrulz wrote:
What I like to do is use the queue's timeout. You can store what the timeout should be in a shift register. If you set it to -1, it will wait forever. So if you do not get a timeout, you can process the message and react to it. If you do get a timeout, you will get the default state and a Boolean output (Timed Out) will be TRUE. So when you do get a timeout, you can do something. If you have multiple things that could be set in a timeout condition, you can store the state to run when you get a timeout in a shift register. A simple Select will make this simple to choose between the queue's state output and the stored state based on the Timed Out Boolean.
For those who find this thread later...
Sometime in the last year I made an upgrade to this setup. I now use a class to hold the message queue, the timeout time for the queue, the message to perform when the Dequeue times out, and a message to perform if there is an error from the Dequeue (typically used to shut down the QMH if somebody destroyed the queue). The only complicated part really is the Wait For Message VI where I decipher which message to pass on (not hard, just several case structures inside of each other).