Starting in LabVIEW 8.0, LabVIEW introduced the concept of “clones” to reentrant VI instances — a pretty advanced topic. Because, spawning multiple instances of asynchronous “process” VIs will come up again, in the future, it’s good that we introduce this concept. Now, back to the point… with the introduction of “clones”, each reentrant VI instance has its own Front Panel (instead of sharing one single Front Panel between all instances). In LabVIEW 8.2, clones were taken another step further and debugging of clones was introduced — each clone has it’s own block diagram, allowing it to be debugged independently. These are really great features and along with these new features came a little gem that I didn’t even notice until today: a new VI Property called Clone Name.
The Clone Name property is the VI’s name followed by a colon and the clone number (e.g., “MyVI.vi:4″ and “MyVI.vi:7″), which is unique for each clone instance — the same as what would appear on the Window Title of a clone’s Front Panel. This new feature is really great, because it is a unique handle that can be used for addressing specific clone instances. Often, clones are used for spawning asynchronous processes. The way that this is done, is to open a reference to reentrant VI, passing option 0×08 (prepare for reentrant run) to the Open VI Reference function. Then parameters are passed to the clone instance using one of the the “Set Front Panel Control Value” methods, and finally, the VI is run using the Run VI method.
Now that both the spawner and the clone can use the “Clone Name” as a key to uniquely identify the clone instance, other mechanisms can be used to pass data to the clone. For example, a named Queue or Notifier can be used to pass data directly to the clone of interest. This is especially useful when the Front Panel of the reentrant VI does not exist due to it being removed during an EXE build or running on a “headless” run-time system.
One parameter that you probably want to pass the clone is the new clone’s own VI reference — the one created using the Open VI Reference function. This is a very special reference, because (unlike an implicit VI Reference ) closing it will cause the clone to stop executing immediately — killing the VI dead in its tracks. Generally, you will want to pass this to the clone, so that the clone can be in charge of closing it, when it completes execution.
Thanks for taking the time to learn about this advanced topic. We’ll certainly make use of it, soon