LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Are user events valid before the event structure executes?

Solved!
Go to solution

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.

 

 

User Event_BD.png

=====================
LabVIEW 2012


0 Kudos
Message 1 of 6
(2,762 Views)
Solution
Accepted by topic author SteveChandler

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

Message 2 of 6
(2,755 Views)

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).


___________________
Try to take over the world!
Message 3 of 6
(2,746 Views)

@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.

=====================
LabVIEW 2012


0 Kudos
Message 4 of 6
(2,726 Views)

@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.


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(2,712 Views)

Thanks Yair for linking the lava threads I had in mind.

 

Felix

0 Kudos
Message 6 of 6
(2,696 Views)