VI Server References
In today's video, I answer the question "why doesn't the VI in the picture above work?"
Although a seemingly simple question, the answer involves some advanced VI Server topics, including the "lifetime" of VI references.
While putting together this video, I found a lot of other potential topics for future posts (e.g. What's a "This VI" reference? What's the difference between a subVI call, the Run VI method, and a Call by Reference node?) If you have other questions on this topic, please feel free to post a comment and I'll try to get you an answer!
- Christina
PS Here's the same video on YouTube in case the other link doesn't work for you.
Labels: vi_server
9 Comments:
Christina, a nice video blog post on an important and interesting issue.
I think thread spawning in LabVIEW has been somewhat neglected issue. It is because of this reason I released the Active VI Toolkit at my blog ExpressionFlow.
That definitely covers the topic well. When I first saw the question and the piece of code, I immediately thought "well, the answer is obvious, but the question might be wrong under some circumstances". Turns out you covered those circumstances. :-)
Nice article/video, Christina. I've had to deal with VI (and queue, notifier, etc.) lifetime issues a thousand times and I'll probably do so a thousand more. These issues can be very tricky and it pays to understand what's going on behind the scenes. Thanks for the info.
Christina. I've got a follow-up question that relates somewhat to your article: How come this code doesn't work? Thanks in advance for any help.
Tomi, Yair, and Jim, thanks for your comments!
Jim, I see that you've already submitted a bug report (thank you!) for the problem with the "All VIs in Memory" property. I hereby officially confirm that this behavior is a bug. The referenced VI is fully loaded into memory when the Open VI Reference completes execution, but the All VIs in Memory property is filtering it out of its list incorrectly. I looked up the CAR and the developers investigating the problem have found a workaround: "Place an empty sequence structure immediately after the open vi reference." I apologize for the inconvenience, and hope this helps!
Christina: thanks for confirming this bug and for the work-around.
Hi Christina
Thanks for this video, can somebody of the documentation team make it an application note. I'm still of the old kind and like something written down.
Albert,
I asked our documentation team to look into it. We don't actually have app notes anymore, but the content could be used in the Help or in a web document. Thanks!
As a side note to this post, if you do close the reference of a VI that is still running, LV will temporarily lose window focus. This will also result in a large spike in CPU usage as the 'killed' VI is cleaned up. If the user was in the middle of typing data into a control when this happens, then they will be prevented from continuing until they click on the control again. There is a CAR for this issue.
Post a Comment
<< Home