02-01-2013 07:17 AM
As I am always learning new things in Labview, I have a question.
Can there be a rece condition if I use the same SubVI twice within the same VI? See attached.
Solved! Go to Solution.
02-01-2013 07:20 AM
if it is done at the very same momment (race condition), otherwise you can use the same vi at different processes.
02-01-2013 07:24 AM
So, if I understand you correctly, the VI can have two instances running at the same time?
02-01-2013 07:50 AM
hm.. I would say you're speaking about reantrancy --> VI properties --> Category "Execution"
The point is that the normal behavior let's your second VI execute when the execution of the first instance is done... The question is how time critical your application is and: are you working in a parallel structure? When everything is serial and working with the dataflow the instances of your VI will never be executed at the same time...
Don't know.. does that solve your question?!?
02-01-2013 07:52 AM
By default, a VI can only have 1 instance at a time. This means that if a VI is running and another VI calls it, the new calling VI must wait until the subVI completes in order to run. This is desired if you are retaining state information (Action Engines or Functional Global Variables). If you are not maintaining state, then it can probably be safe to set the VI to be reentrant, which means that there can be multiple instances of the VI in memory, each instance will have its own block in memory. This uses more memory. For the most part, subVIs are going to run fast enough that you don't need to worry about the reentrancy as the waiting to run will be really short.
Quickly looking at your code, I wouldn't worry about the reentrancy since your subVI is going to execute quickly.
02-01-2013 07:57 AM
Thank you, crossrulz.