User | Kudos |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
There is a debate between the use of Global Variables and Functional Globals to make variables globally available. The reasons for using a Global Variable appear to be that they are easy to use and execute faster. The reasons to use a Functional Global appear to be that they reduce data copies and avoid race conditions.
I'm only talking about Functional Globals that set and get values. Action engines are a different thing and there's the standard implementation method.
I'm not too worried about data copies as my global variables are simple and memory is cheap. However, race conditions do worry me. I assume that for a Global Variable, even if someone is accessing the variable to write to it, a reader elsewhere can read at the same time and therefore either get the earlier or later value.
The idea is to provide an option on Global Variables to make them race-condition-free (that is, same behaviour as Functional Globals). When activated, a small padlock could appear on the global to let everyone know it's race free.
You would now have pretty well all of the benefits of Functional Globals and Global Variables. Thereby putting an end to having to produce a VI, put in a loop, shift register, states, etc, just to set and get a variable. Action engines on the other hand great and worth the effort!
Maybe this Global Variable behaviour should not be an option, but the only way it operates?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.