I have a couple of suggestions for this issue:
1. Is not recommended to use IMAQ images with a Queue operation, the IMAQ image wire is the pointer to the memory place where the data is stored, so is not the actual data, for that purpose you may better use the array of data given by 'IMAQ Image To Array'. And the reason is that it can give bad behaviour since maybe you use the pointer of an image that has already been overwritten, so you pass bad or incomplete data.
2. The AVI utilities that I am aware of are NOT meant to be used in a live acquisition. The suggested operation from the companies that have developed those VIs is to save all your images to a folder, and then from a folder with images pass them to an AVI file in a separate operation. I would suggest
that you acquire your image in a ring acquisition (buffered) so you will make sure every single image gets saved. Afterwards, just make an algorithm that opens that folder and converts all the images in AVI.
3. As for stopping the two loops at the same time, you may want to run them in SubVIs as for separate threads, or use the queueing functions in the way it is described in the example program shipped with LabVIEW. Go to Help >> Find Examples >> Optimizing Applications >> Synchronizing Tasks >> QUEUE Basics Part I. In the block diagram check the Sub VI "Queue Consumer Producer" is on frame number 9 of the major sequence and in frame 1 of the small sequence embedded in that frame 9. That Sub VI (check block diagram) uses queue for running two loops and a special way of local variable. Just check it out.
If you have special requests for LabVIEW programming please post them to the LabVIEW section of DevExchange, and if you have special requests for IMAQ please post them in th
e Vision section that will attract enthusiasts on each respective area.
Good luck!
Nestor S.
IMAQ/Motion Support
National Instruments
Nestor