What is the best way to transfer data between 2 or more individually
running threads? Like say you have 2 threads running the first
thread continuous processes data and sends it to the second thread
which formats and graphs the data. I know globals are an option,
but I also know that they may not be the most efficient option.
Any thoughts on this are much appreciated.
I prefer using Queues, see the producer/consumer model provided as a template with LV 7.0 and above. I would avoid globals, and use a synchronization technique unless the loops are asynchronous (then maybe just use a local variable),
The threads need not be in the same vi at all to use queues, you can create a queue in one vi and pass it as a reference to many subvi's and use just the same I will attach an example later. If we were limited ro a single vi we would be in a bunch of trouble.
Here is an example in 7.0, I use this format often. Sorry about the sloppy coding but its lunch time and the only free time i had to fit this example in, hope it helps.