11-06-2024 04:37 AM
I have several VIs that runs independently. They don't need to pass data between them but when one of them is closing the others also must close. One Vi is always started first
Is there a good way of doing this?
I am thinking of using a Functional Global but i am not sure that this is the best way. I have attached a simplified example using FG to pass info about Running. The first Vi is always started first but the others may start in different orders.
A User event may not be useful for this.
I think that there must be a smarter way of doing this
11-06-2024 04:45 AM
Since you need to poll the info anyway, why not to use a standard global variable?
11-06-2024 05:04 AM
In general nothing principal wrong with this, and you can use classic global as suggested above. The only one possible race condition in theory could occur in case if one VI will be started exactly at the time point when other one finished, then one will write true at start, the other one — false at finish, and the third VI which is already running may stop or not depend on which write action will occur first. This can be solved with rendezvous which you can add between first write and while loop, then you will start all VIs "synchronously" and they will wait each other, but it depends from your high-level design and overall timing diagram — how they started and stopped.
11-06-2024 05:36 AM
FG or Global should work fine, don't overcomplicate things. Remember KISS.