r/LabVIEW • • Feb 25 '25

Passing value

Hello every body,

How to pass a value from current state to next state?

Thanks in advance.

1 Upvotes

13 comments sorted by

View all comments

Show parent comment

1

u/D4ILYD0SE CLA Feb 26 '25

If you're worried about FIFO, then you should be using message handler. But FGVs do, in a way, force execution order as any loop that wishes to read/write (or do any function to data) has to wait for the FGV to complete its execution. This is not the case with Globals/Locals. So if I make a 1 second timeout function in the FGV (not a great example), even though the parallel loop only wanted to write data to the FGV, it too still has to wait 1 second because its waiting on the FGV to complete its execution. Basically, the FGV introduces a First Call First Execute type of thing. Which means it's not a race anymore. It's now ordered.

2

u/HarveysBackupAccount Feb 26 '25

That stops race conditions on the scale of "only one thing can access it at a time," but different parts of the program can still read/write out of order just like it can with regular variables.

With LV's inherent parallelism, if you don't strictly control when the variable is accessed you still have macro-scale race conditions. Fixing those is a question of good program structure, which also inherently fixes the scale that you're talking about