LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a multi-threaded VI?

Hi Rolfk,

Thanks for the info! However, I still have some difficulties. I have already set the sub-vi to be Retrant , but when the main vi called it, the first one was launched correctly, but the following ones failed with this message:

Error 1000 occurred at Invoke Node in Main_Rand.vi
Possible reason(s):
LabVIEW:  The VI is not in a state compatible with this operation.
Method Name: Run VI

What's the reason for this?  Also, what is a .vit? some variation of a vi?

Thanks!
0 Kudos
Message 11 of 14
(1,048 Views)

Hi LyLee,

      When you Open the VI with VI server, don't forget to specify the Options input - it should be 8 (prepare for reentrant run.)  If the VI's Execution properties also specify Reentrant, then you should have no problems!  Pleas post you VI if it still doesn't work...

Cheers. 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 12 of 14
(1,044 Views)
Thank! My vi runs with the option 8. But I just wonder, why is that mishklyar 's vi doesn't have the 8 option but still opens multiple instances? Am I missing something?
0 Kudos
Message 13 of 14
(1,039 Views)


@LyLee wrote:
Thank! My vi runs with the option 8. But I just wonder, why is that mishklyar 's vi doesn't have the 8 option but still opens multiple instances? Am I missing something?


AFAIK if you load a VI template *.vit into memory LabVIEW will instantiate it by creating a differently named copy of the template VI in memory UNLESS you specify a specific option at the Open VI Reference but if you load a reentrant VI, LabVIEW will load that VI for editing and therefore not prepare it for running reentrantly UNLESS you specify an option.

Inconsistent? Not really. Besides that this has historical reasons with reentrant VIs (although a lot more limited than nowadays) predating the VI server, it is normally the Open VI Reference's default behaviour to open a VI in a way that it can be edited in memory.  For a VI template this does not matter since the created VI is a completely and perfectly editable and runnable VI in memory  and the *.vit was a sort of cludge back in those days added to allow dynamic instantiation of VIs without having to review the entire LabVIEW code for improvement of the reentrant operation. Since they have been working on reentrancy and gotten it to the point where it is working correctly and supports most things one could wish for implementing dynamic instantiation but it has taken aobout 3 major versions to get there.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 14 of 14
(1,020 Views)