Jump to content

Shared clone reentrant execution. How can I get clones shared?


_Y_

Recommended Posts

I tried to reuse clones of a re-entrant VI and did not succeed. Help says: “Shared clone reentrant execution—Allows parallel execution … this type of reentrancy reuses clones among VI calls. If a VI call occurs while all clones are in use, LabVIEW allocates a new clone for that VI call…”. As I understand, if there is a non-used clone, it has to be used instead of making a new allocation.

 

I created a small project (attached archive Test_DynamicCloning.zip). It has two VIs. The  r.vi is set as Shared clone reentrant execution. It does not do much but only counts the number of invocation with an uninitialized shift register and closes own FP after 5 sec (alternatively it is closed with a button click):

 

HjUUNh1u.gif

 

main.vi creates a new clone on button clicks:

 

za1pdpHX.gif

 

But each click of the button results in a new clone that is indicated by both: new clone number in the title bar and by the shift-register counter.

 

Now I set Auto Dispose Ref to true and run again. The title bar indicates reusing of the same clones but the shift-register counter shows that the clone is used first time.

 

So, I need your opinions: What happens in the background? Why and how Auto Dispose Ref influences the cloning process? Why the shift register is re-initialized?

 

Thank you

Test_DynamicCloning.zip

Link to comment

The “shared clones” setting affects operation of statically-called VIs (such as an ordinary block-diagram use).  Dynamic use depends on the options to the “Open VI ref” function; in your case option 0x8 creates a new clone with each use (with “auto dispose ref” you are destroying the clones and just reusing the clone numbers in new clones).

 

To use “shared clones” dynamically, look at the NI example "AsynchronousCallAndCollectUsingOption0x40.vi”.

 

— James

Link to comment

crossrulz, drjdpowell, thank you.

 

Seems call-and-collect can solve the problem but not in the way as described in the example. I did not find a way to call reliably a clone by ref but.

 

Instead I use : i) call-and-collect to keep the ref alive; ii) an additional state machine in the reentrant VI to keep it running and iii) communicate with each clone using DVR. Not so simple but functional.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.