01-30-2014 11:15 AM
I have several producers aquiring data into a functional global (one functional global per producer). These functional globals are identical except for the name. Would it work to have only one functional global VI and obtain a separate reference for each producer? The matching consumer would also use the proper reference to consume the data.
The functional global contains an array of the data which must be parsed by the consumer. It is possible that the array of data may not contain a complete set of data on a single "store" operation by the producer. The consumer, of course is written to check for a complete data record before completing processing on the record.
Solved! Go to Solution.
01-30-2014 11:22 AM
That sounds like your architecture needs some help. How does the consumer know to look at the FGV? Why not just send the array of data with the queue? Then you might not need the FGVs. They could just be simple subVIs that your producers use.
01-30-2014 12:17 PM
Regardless of whether there is a better way, the answer to the question is yes. The FGV needs to be reentrant and the reference you open needs to be reentrant too and then you can use the CBR node to run the specific copy of the FGV.
01-30-2014 12:32 PM - edited 01-30-2014 12:57 PM
@tst wrote:
Regardless of whether there is a better way, the answer to the question is yes. The FGV needs to be reentrant and the reference you open needs to be reentrant too and then you can use the CBR node to run the specific copy of the FGV.
I thought a reentrant vi would not maintain the state of the uninitialized shift register from one call to the next.
I do agree that queueing the data would be better.
01-30-2014 12:46 PM
@Les__Bartel wrote:
@tst wrote:
Regardless of whether there is a better way, the answer to the question is yes. The FGV needs to be reentrant and the reference you open needs to be reentrant too and then you can use the CBR node to run the specific copy of the FGV.
I thought a reentrant vi would not maintain the state of the uninitialized shift register from one call to the next.
A reentrant VI will maintain the state of its uninitialized shift registers. However, you need to be really careful how you do this. First of all, you need to make sure it is set to Preallocate Clones. What will happen in this situation is that each different place you call that subVI will each be a different clone. This means that each call will have its own data. The problem with this is that you can't share the data across multiple instances and therefore multiple loops. If you don't believe me, go play with the Mean Point By Point VI.
So what happens if you set it to shared clones? A big freakin' mess. You will have no control over which clone will be called where and there will be some major data corruption.
This is why FGVs are almost always non-reentrant.
01-30-2014 03:19 PM - edited 01-30-2014 03:21 PM
tst wrote:
Regardless of whether there is a better way, the answer to the question is yes. The FGV needs to be reentrant and the reference you open needs to be reentrant too and then you can use the CBR node to run the specific copy of the FGV.
This came up in a past conversation. The use of references looks like this: