LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Share cluster data between 2 timed loops

In your situation, the simplest and cleanest solution is to wrap your data into a data value reference and use that in your running loops.  This results in very little extra code or subVIs and will probably outperform the functional global.  It is also a lot safer to use, since it gives you a global mutex any time you access your data.  As with the functional global / action engine, it is possible to abuse it and get race conditions, but this should not happen if you keep all data read/write inside the in-place element structure you use to read/write the data and do not pass any of the data outside that structure.  If you do pass data out, do not pass it back in.  These two simple rules will keep you pretty safe.

0 Kudos
Message 21 of 23
(441 Views)

@DFGray wrote:

In your situation, the simplest and cleanest solution is to wrap your data into a data value reference and use that in your running loops.  This results in very little extra code or subVIs and will probably outperform the functional global.  It is also a lot safer to use, since it gives you a global mutex any time you access your data.  As with the functional global / action engine, it is possible to abuse it and get race conditions, but this should not happen if you keep all data read/write inside the in-place element structure you use to read/write the data and do not pass any of the data outside that structure.  If you do pass data out, do not pass it back in.  These two simple rules will keep you pretty safe.


I thought the whole idea behind n FG was not speed, but reliability - i.e., no copies of data being made so no chance of stale data?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 22 of 23
(433 Views)

That will depend upon your implementation of the functional global.  If you pass the data out of it, you make a copy.  With data value references, it is much easier to avoid copies.

0 Kudos
Message 23 of 23
(430 Views)