hooovahh Posted September 12, 2013 Report Share Posted September 12, 2013 I was talking with a coworker of mine and they had an issue where they were creating clones of a reentrant VI. But in this VI is a functional global VI. Now normally this VI is non-reentrant so there will only be one copy of this VI in memory, and any clone writing to will likely overwrite the data there. Then all kinds of race conditions happen, and then there is the issue of this being a blocking call to other clones too. So I wanted to see if I could make a reentrant global, that only really was used in one of the clone VIs made. Attached is my attempt at it. Not much in line of error handling but I think all references are closed as they should be. Run the Main.vi and it will create 3 clone VIs with a graph control where you can add data and clear data to the graph. The data the graph loads is from the reentrant global, but only one clone should use one global clone. Keeping track of all these global clones is yet another global (this was a poor test but I wanted to just see if it would work). Now my main can have access to all the globals too for what ever reason I may want. Has anyone done anything like this? Does anyone find this useful? Would a shift register in the Clone be alot easier? (probably) Reentrant Global Test.zip Quote Link to comment
ShaunR Posted September 12, 2013 Report Share Posted September 12, 2013 Why not just use a DVR and the "global clone" just accesses the DVR 2 Quote Link to comment
drjdpowell Posted September 13, 2013 Report Share Posted September 13, 2013 You don’t need the “Open VI Ref” dynamic-launch complexity; just use a static, strictly-typed ref (each one of which refers to a separate clone): Quote Link to comment
hooovahh Posted September 13, 2013 Author Report Share Posted September 13, 2013 Why not just use a DVR and the "global clone" just accesses the DVR Awesome idea. I don't use DVRs much (or OO) so maybe that's why my mind didn't go there, but I much prefer how the DVR implementation works. Quote Link to comment
ShaunR Posted September 13, 2013 Report Share Posted September 13, 2013 (edited) Awesome idea. I don't use DVRs much (or OO) so maybe that's why my mind didn't go there, but I much prefer how the DVR implementation works. Well. To all intents and purposes, There is no difference between that and using a non-re-entrant global-just more complicated.They use the DVR technique in POOP because they don't have a method of creating singletons easily. With a LV2global, it is inherently a singleton as all VIs are singletons by default. Edited September 13, 2013 by ShaunR Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.