Global Variables are to be used with caution (see NI white paper http://www.ni.com/white-paper/5317/en ). One scenario however - Write Once Read Many - is a useful and a safe one).
If a global variables VI is a part of a project, LabVIEW has means to know whether there may be multiple write nodes for a global in the project (including reentrant VIs).
I suggest that globals in a project be Write Once by default. In this case every attempt to add an additional write node would result in an error. "Write Many" behavior would be an option to be explicitly chosen by the programmer.
Not only race conditions would be excluded in this way, but the compiler can be optimized to avoid unnecessary copying of data.
Admittedly the same goal can be achieved with Functional Globals. However many LabVIEW users are not programmers and may never heard of that concept.
Similarly, adding more than one write node for a local variable should produce a warning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.