LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

global variable and reference

Hi,

Could you tell me the difference between the "global variable" and "reference" ?

If i create a control in a VI and i need to use its value in a subVI should i use a reference or a global variable ?
In the other hand, if i create control in a subVI and i need to use its value in a VI should i use a reference or a global variable ?

If you could explain me by a VI that would be wonderful
Thx,
Samer,
0 Kudos
Message 1 of 2
(2,677 Views)

Hi Samer,

I wrote the Action Engine Nugget to illustrate a safe and effective way of sharing data between multiple thread.

Re: your Q

Both gloabl variables and reference>Value are subject to potential race conditions.

Globals require all of their instances be updated anytime one is updated. So they dont' scale well either.

References force a thread switch to the UI thread (single thread so this is a bottle neck)

So PLEASE take a look at that Nugget.

Thank you,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 2
(2,671 Views)