01-04-2010 07:17 PM
01-04-2010 07:48 PM
I'm not clear on why you want to "generate a new instance of a program that writes the number associated with the FOR loop to the file 2 times."
If that's the result you want, there are certainly easier ways.
If you're just experimenting with multi-threading, then you can spawn instances of a VI, without spawning instances of a PROGRAM. You have to make them REENTRANT to have them truly independent.
If you're just experimenting with parallelism, be aware that you can run any number of FOR loops in parallel, and they will indeed run in parallel. No special action required.
Perhaps if you explained what you are looking for a bit deeper.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
01-05-2010 04:36 AM
01-05-2010 04:39 AM
well the stop button does not work but you get the picture. I basically need to start with one of the while loops and based on an input I need to generate another while loop, then on and on...but they must all be started and run in parallel. any help is appreciated thanks.
01-05-2010 07:14 AM
well the stop button does not work
The STOP button doesn't work because you read it once and THEN start four loops. So the value that it read when started is remembered, and it doesn't read the button again.
Change that to a SWITCH and read it INSIDE each loop separately. (Use local variables).
Blog for (mostly LabVIEW) programmers: Tips And Tricks
01-05-2010 08:01 AM
Hmmm. I cannot locate a good example for you, but I know it's possible.
So I created my own example (I THINK I saved it in 8.5 format)
YOU NEED TO HANDLE ERRORS - this example doesn't.
But it does do what you asked.
It spawns any number of subVIs, all of which run independently.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
01-05-2010 10:29 PM
I should point out that there is a race problem with that example.
Because of the way that it READs the current text, MODIFYs it by adding to it, and WRITEs it back, there is a chance that two threads could read the text, both modify it (in different ways), and both write it back, but only one of the modifications would be remembered.
The real solution should use a non-reentrant VI to handle that chore. That way it could only be called from one VI at a time.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
01-06-2010 08:14 AM
This Nugget on Occuences and running VI's in parallel may be helpful.
It explores the question how can we build a real Animusiac app
The example i posted there launches and runs a bunch of background threads.
There was a good follow-up discusion in that thread about multiple threads etc.
Have fun!
Ben