LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure does not consume user event

Hi All,

 

I was running a test to see if I have multiple event strucutes in a single vi that listen to the same user event and when that user event is generated, will all the event structures consume that event or not. From my results, it seems like the behavior in which events get consumed in the event structure is not consistent. Most of the times(almost 90% based on 2 event structures waiting for a single event) all the event structures will consume a user event and and sometimes only 1 will consume it.

 

I have a vi with 3 while loops. Data type of user event is DBL. Inside 1 while loop I generate a user event(a random number) and the other 2 registers to that user event and display the new value in separate indicators. Almost 1 in 10 times one of the event structure does not consume the user event as it does not update the value in the indicator.

 

I am attaching the vi that I created here. Its created in LV2012 SP1.  

 

 

0 Kudos
Message 1 of 3
(2,525 Views)

It's complicated by the fact you are registering for events in different ways.

 

In Loop 1, you have a static registration to the event.  It will grab the event.  If you had a 2nd while loop just like it, it would also capture the event.  Both event structures would execute.

 

In Loops 2 and 3, you have a dynamic registration of the event.  You only created one event registration and shared it between the two event structures.  Only one or the other will handle the event.  Actually it is more like a race condition as to which will handle it.  If they seem to get it about the same time, both will act on it.  If one gets it and handles the event first, then the event no longer exists for the other structure to handle it.

 

You have another variation you did not show.  You could have have registered for the event twice, and sent one event reference wire to one event structure, and the other event reference wire to the other event structure.  Since you have two different event registrations, both event structures would have executed.

 

Search the forums for dynamic event registration and about "splitting wires".  You'll find more conversation about this topic.

Message 2 of 3
(2,520 Views)

Just give your loop 3 it's own Register for Events function. See attachment.

 

steve

 

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
Message 3 of 3
(2,471 Views)