LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reentrant VI

Hi all,

 

I have created an xcontrol. When clicking on the xcontrol i dynamically run a module "Module1" (reentrantly with waituntil done=False, and Autodispose ref=True).

 

I have placed 5 such xcontrol on a FP. Each time i click an xcontrol, one instance of Module1 get launched. 

My requirement is another instance of Module 1 shouldn't get launched when clicking on an xcontrol which has already launched one instance of Module1.

I hope my requirement is clear.

 

Your suggestions are welcome.

 

Regards,

Muthuraman S

Regards,
Muthuraman
0 Kudos
Message 1 of 3
(2,534 Views)

You can store the refnum of your dynamically called VI in a shift register inside your Facade VI.

Then you can check the validity of that VI refnum every time your click event occurs.

 

0 Kudos
Message 2 of 3
(2,528 Views)

If you dynamically launch a re-entrant VI, it will always launch another instance of the VI (this is very useful for launching multiple templates of the same code).  If you do not want to launch another instance, the dynamic VI should be non-re-entrant.

 

Also note that, depending on what version of LabVIEW you are running, the XControls may or may not be in the same context as the rest of your code.  Depending on how you open a reference to the launched VI, it may or may not be in that same context.  Make sure you wire the application reference input when you open the VI so you know what context it is opened in.

 

Finally, you really cannot count on caching references in an XControl.  XControls can go in and out of memory at any time, and LabVIEW cleans up references when code goes out of memory, leading to stale references.  Once again, the exact behavior is dependent on which version of LabVIEW you are using.  Test any behavior thoroughly before commiting to an architecture.

Message Edited by DFGray on 06-29-2009 08:10 AM
0 Kudos
Message 3 of 3
(2,525 Views)