LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

yet another race condition

 

 

clear is run after initialize! 

 

I was suprised to learm that this lead to a race condition. 

The clear command is processed AFTER the Initialize command.

 

It took me a while to find the problem, and it was easy to fix. But is this code really a candidate for a race condition?

0 Kudos
Message 1 of 3
(949 Views)

There is no data dependency between the case structure and the Clear action, so LabVIEW can execute them in whatever order is convenient.  The placement on the screen may make it easy to be misled, but picture that you could just as easily place the clear action on the right side of the case structure - would that change your assumption about the order in which they would execute?

Message 2 of 3
(944 Views)

This is why it's always good, and convenient to use error clusters, not only for error handling but to maintain proper data flow for lack of outputs or some other mechanism to pass data on.  I no of one technician that doesn't bother to wire up functions and initialization code if it was to the left.  LabView will typically flow from left to right and it does as long as things are wired, but if not, there is no guarantee that it will happen.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Message 3 of 3
(930 Views)