03-26-2007 04:25 PM
03-27-2007 04:31 PM
04-25-2007 03:52 PM
If you wire the event registration refnum to more than one Event structure, each Event structure handles dynamic events out of the same event queue. This can occur if you branch the event reg refnum out output of a Register For Events function to another Event structure. This causes a race condition, because the first Event structure to handle the event can prevent the other Event structure from receiving the event if it completes the event case before the other Event structure executes.
To avoid this problem, make sure you wire each Event structure which handles dynamic events to a unique Register For Events function.
04-25-2007 06:36 PM - edited 04-25-2007 06:36 PM
Craig wrote;
"...If you wire the event registration refnum to more than one Event structure, each Event structure handles dynamic events out of the same event queue."
So the wire is a queue..... and the event structures are read from queues.... that are mutually exclusive with the other events....?
Ben
Message Edited by Ben on 04-25-2007 06:37 PM
04-26-2007 04:53 AM
This behavior strikes me as counter-intuitive. If I register a value change event for the same control in two event structures, each structure will have its own queue.
It is not unreasonable to expect that this would be the same for dynamic events.
In any case, in my example, note that the bottom loop doesn't actually use the dynamic event, so I don't see why it gets stuck and waits for the timeout event.
That does strikes me as a bug.
05-06-2007 04:44 AM
Craig, I'm still waiting for an answer on this one.
Basically, there are two questions here.
First, as a tangent to the original question brought on by what you quoted, why is the event structure only removing the event from the event queue after the event case completes and not when the event case starts? This seems to be a source for confusion because multiple event structures might or might not respond to the same event. Is this because of filter events?
A more intuitive implementation for the users would probably be if each event structure which had the dynamic event terminal input wired would create a queue for each selected event and the register\unregister nodes would simply trigger whether or not each of the queues accepts these events. That way, each event structure would have its own queue. I can understand how that would be a problem, though.
Second, and more important, do you still think that the issue I described is not a bug? It is true that the registration refnum in the example is branched, but the bottom loop does not actually use it for anything, so why does it get stuck?
In any case, if this is the case, it would probably be useful if there was an option in the LV editor to lock such wires so that they could not be branched. I assume this option doesn't exist, because it's anti-dataflow and because I know of no other wire which can not be branched, but since you say branching them is always bad, then they should not be "branchable" at all.
05-06-2007 12:44 PM
05-06-2007 12:58 PM
@tst wrote:
Second, and more important, do you still think that the issue I described is not a bug? It is true that the registration refnum in the example is branched, but the bottom loop does not actually use it for anything, so why does it get stuck?
05-06-2007 01:01 PM
@Jim Kring wrote:
For example, if someone (a bad neighbor) takes your newspaper from your porch before you wake up, then you won't get one.
Except that dynamic events seem to be miraculous quantum creatures - sometimes, both you and your bad neighbor can have the paper at the same time. You can both grab your heads at the same time when you see that your stock crashed or you can both laugh at the same comic strip.
If dynamic events behaved exactly like queues, it would become evident that you made a mistake much earlier. I guess that the documentation needs to be more explicit about this.
In any case, I still think the behavior I pointed to is a bug, since the bad neighbor in this case only comes to your porch in the morning, but never actually touches your newspaper.
05-06-2007 01:44 PM
Jim wrote:When an event structure executes, it flushes all events in the registration (subscription queue) that are not handled by the event structure.
That would make sense when you think about it, but is this documented anywhere?
I don't see how that would explain the behavior I described, though.