02-25-2015 04:10 AM - edited 02-25-2015 04:12 AM
Hi,
I wrote a program that controls many instruments in a setup.
Two of the functionalities of the program are: view image from camera and save video from camera stream.
Since these operations happen in parallel to other user inputs, I put them in 2 while loops with a queue to operate them. I also wired a boolean reference so I can stop them from outside the VI.
When I press the general STOP button the loops stop running but the program sometimes gets stuck inside the video loop. When I “highlight execution” nothings shows but I see that the number of iterations can only be shown by probe #4 and not #3 ( see in attached image). Of course the program never reaches the next frame (#3) and the program just hangs forever or until I press the Abort execution.
It seems to me like a Labview bug but “recompiling all” didn’t help. Can someone have an idea why does this happen? Is it related to the queue read by both loops?
BTW this problem happens even if i never started recordeing video or viewing the image.
thanks
Amos
Solved! Go to Solution.
02-25-2015 04:26 AM - edited 02-25-2015 04:28 AM
Hello amose,
when your have one element in your queue both loops enter their "False" state. The element is then dequeued in one of the loops, which in turn forces the other loop to wait for a new element. You should try to avoid using more than one dequeue on the same queue (A queue can have multiple enqueues though).
From what I can see using two seperate queues for your image and video functionalities might be more suited to what you want to achieve.
Kind regards
02-25-2015 10:16 AM
A queue should only ever have 1 place that dequeues. So I agree that you should use two different queues for this effort.
Additionally, do not use the Get Queue Status to check to see if data is available. Just let the Dequeue do the waiting. If you need to check other things in the loop, use the timeout. This simplifies your code quite a bit.
02-25-2015 01:38 PM
Thanks,
I used many times the dequeue without paying attention to the timeout input.
this is the timeout that was not wired and hanged my execution when the queue was already emptied by the other loop.