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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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