LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inherited reentrancy?

I understand some things about reentrancy:

Say my SubVI "S" has an uninitialized shift register that is supposed to remember some value "V" from one call to the next.

If S is normal (not re-entrant), and S is called from two or more places, then there is only one V - each caller would interact with this same value of V.

If S is reentrant, then there are TWO separate Vs - each caller would interact with its own value of V.

Suppose he caller VI "C" calls S in two places - there would be two separate values of V.

Suppose C is itself reentrant. Suppose there is a master VI "M" which has two calls to C. Each instance of C calls two instances of S. Are there then FOUR different values of V?

In other words, does the reentrancy get pass
ed up the chain?
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 7
(3,050 Views)
This could get confusing quick, but I think I understand how it all works.

The reentrant property does not affect any callers or callees'. It strictly on a VI by VI basis.

In your last example, there would be 4 values of 'V', since both C and S are reentrant, 'M' would call two instances of 'C', and each of those would call two instances of 'S'

If only S were reentrant, you would have 2 values of 'V' since 'M' would be calling the same instance of 'C' which is calling 2 instances of 'S'.

If 'C' were renetrant and not 'S', you would have one value of 'V' even though you'd have two instances of 'C', they both would be calling the single instance of 'S' four times.

I hope that came out correctly and didn't confuse matters more. It can be a bit t
ricky sometimes to get my thoughts from my head to my fingers.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 7
(3,050 Views)
"In other words, does the reentrancy get passed up the chain?"

My understanding of reenetrancy says it should.
I never used it like that before, but I created little program that duplicates the scenario you put in the post, and it worked correctly, as I expected. I passed data thru terminals to get the updated values to the main vi.
0 Kudos
Message 3 of 7
(3,050 Views)
OK - that occurred to me that there could be 4 values of V, but I wasn't sure. (It's good in my case).

I had always thought about it in terms of callers - there is one V for each caller instance. But if the caller is reentrant itself, then S has FOUR callers, EVEN THOUGH there are only two instances on the diagram.

Thanks for your clarification.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 7
(3,050 Views)
OK, thanks.
The confusing thing for me is that S would have FOUR callers (and thus FOUR values of V), even though there are only TWO instances of it in the code.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 7
(3,050 Views)
The thing you have remember is that even though there are only two instances of �S� in the code of �C�, there are two instances of �C� (if set to reentrant) in the code for �M�. So each instance of �C� will have its own data space within �M�, and as it loads its subVIs, it creates a new data space for anything it sees as reentrant.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 6 of 7
(3,050 Views)
For those playing along at home, I have attached a library with the conditions I was asking about.

Indeed, there are FOUR data spaces.

Perhaps I should have just done the experiment first...

In any case, thanks to all.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 7
(3,050 Views)