Jump to content

Reentrant Global In Clones


Recommended Posts

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

Link to comment

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 by ShaunR
Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.