04-19-2012 09:09 AM
Hi All,
I am trying out some new architectures and I am hitting a problem. I hope you can help.
What I want to do is create a DVR in a toplevel VI and then pass this DVR to a second VI which I then run using the invoke node. In particular I want it to be an asymetric call so I have set 'wait until done' flag to false.
A valid reference is passed to the second VI. However when the toplevel VI stops the the reference (now also in the second VI) is destroyed. I tried both options with the 'Auto Dispose Ref' flag (and I believe this isn't relative anyway).
Can anyone help out?
Many thanks in advance,
Dave
Solved! Go to Solution.
04-19-2012 09:19 AM
take advantage of what you have observed;
DVR is alive as long as the creator is alive.
So create the DVR in a sub-VI that is also part of th hierachy of the VI you spawn.
Ben
04-19-2012 09:21 AM
That's exactly the workaround I've just started while waiting for an answer;-)
Dave
04-19-2012 09:25 AM
@DeltaJ wrote:
That's exactly the workaround I've just started while waiting for an answer;-)
Dave
Then pat yourself on the back for me.
As far as I known that is the only "Correct Answer".
Ben
04-19-2012 09:25 AM
Actually I've just been thinking - would the synchonous call to the spawned VI means that right after the invoke node is the perfect place to delete the DVR after you are finished using it (assuming you only use it in the spawned VI)?
04-19-2012 09:30 AM
04-19-2012 09:30 AM
@DeltaJ wrote:
Actually I've just been thinking - would the synchonous call to the spawned VI means that right after the invoke node is the perfect place to delete the DVR after you are finished using it (assuming you only use it in the spawned VI)?
If you are talking about "Call by refernence", I would say yes.
Otherwise you will have to ensure that the sub-VI completes or use another mechanism to know whn the DVR can be destroyed.
Please report what worked so others can follow you.
Have fun!
Ben
04-19-2012 09:31 AM
Yes call by reference was what I was thinking about.
Thanks again for your help and comments Ben,
Dave
04-20-2012 08:11 AM
In this particular case, if you do the timing correctly, you can pass the data while allowing the original DVR to die. The sequence would be something like this:
You end up with the same data in a new DVR, still in-place, if you are careful, and you don't have to worry about a subVI to keep the DVR alive.
04-20-2012 10:59 AM
Thank you for the suggestion DF - its an approach I will keep in mind for the future!