07-01-2010 07:29 AM
Dear all,
I have a question about how RegEventCallback really works in LV.
In my system, we have a controller that signalizes the end of movement by sinding a messages. In LV there messages are captured as events, via the Reg Event Callback mechanaism and Event strucutre. I have developed some bunch of subVIs where each is launched from the mainVI pad. Each subVI employs the event-driven mechnism to communicate to controller. Each time subVI starts (on at a time) it registers own callback VI, and unregisters when it ends.
The problem is that if I open-then-close subVI, I see the the each message from the controller are multiplicated. The mupltiplication exactly corresponds to a number of subVIs open-and-closed previously. If I stop the mainVI, the multiplication resets from 1.
So, what could it be? Surely it is not a controller problem. Could it be that the callback VI, which was unregistered for events when the subVI panel was closed, remains in memory and continues to recieve and transmit the messages from the controller? So, each time when I open and close the panel of some subVI, the new copy of callbackVI resides in memory and makes a new thread of messages?
How could it be stopped, or bypassed?
07-01-2010 09:45 AM
Are you sure sou're unregistering for the events when you're finished with them? Otherwise you're going to keep accumulating "listeners" without having anyone actually doing the listening.....
07-01-2010 10:11 AM
Yes, I'm 10 times surely unregistreing for events.
07-01-2010 02:50 PM
Well then I think you need to post some code.....