09-27-2012 08:20 AM
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.
09-27-2012 09:40 AM
@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?
09-27-2012 09:42 AM
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.