LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Kill Reg Event Callback function?

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?

 

0 Kudos
Message 1 of 4
(2,436 Views)

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

0 Kudos
Message 2 of 4
(2,426 Views)

Yes, I'm 10 times surely unregistreing for events.

0 Kudos
Message 3 of 4
(2,421 Views)

Well then I think you need to post some code.....

0 Kudos
Message 4 of 4
(2,412 Views)