08-03-2011 03:10 PM - edited 08-03-2011 03:11 PM
If I create and register for a user event and immediately generate that event before my event structure has seen the registration refnum, is the event still guaranteed to be seen by the structure? That is, are events queued up? It works but I am wondering if I can rely on it. I am very sure that I can but I am creating some production code and want to be assured that I am not just taking advantage of a bug.
A picture is worth a thousand words.
Solved! Go to Solution.
08-03-2011 03:14 PM
To my understanding, the register for event creates the queue. That behaviour is still the same as it was in 7.1, so don't expect it to change.
I think there was a recent discussion on lava on this, but I didn't follow it.
Felix
08-03-2011 03:26 PM
Generally, Felix's explanation is correct and the queue exists from the moment the register node executes, so the answer is that you can rely on this.
You should, however, be aware that when playing with dynamic registration you can experience some unexpected side effects, as you can see, for example, in this LAVA thread - http://lavag.org/topic/13607-dynamic-event-reregistration/
Another example would be this - http://lavag.org/topic/13970-unexpected-event-structure-non-timeout-behavior/page__view__findpost__p...
Or what happens if you split the registration refnum to more than one event structure (hint - NEVER do that).
08-03-2011 04:32 PM
@tst wrote:
Or what happens if you split the registration refnum to more than one event structure (hint - NEVER do that).
I can only guess what would happen. When I was still pretty new to LabVIEW I tried to dequeue the same queue in two loops. Sometimes one got the data it and sometimes the other. I am thinking that would happen with events too.
08-04-2011 12:57 AM
@Steve Chandler wrote:
Sometimes one got the data it and sometimes the other. I am thinking that would happen with events too.
Yes, that is what will happen.
Except, sometimes both will get it.
And at other times, neither.
So, like I said, NEVER do that - a registration refnum should ALWAYS go to a single event structure. The links in my reply (and the links from them) can demonstrate some additional quirks.
08-04-2011 02:58 AM
Thanks Yair for linking the lava threads I had in mind.
Felix