LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Message queue won't flush

Hi, I have a few loops running in parallel. Before they run, I create a reference to a queue so my other loops can use it to enqueue messages. One of my loops dequeues the elements and displays them in an array of strings. I have a button that should allow the user to flush the queue, but the queue refuses to flush. It seems like a pretty straightforward task. The queue continues to hold all the messages since the start of the program. It should only hold the new messages after the user has flushed the queue. Any suggestions?
Thanks,
Sima
 
0 Kudos
Message 1 of 9
(4,360 Views)
Sounds like you may be using the Preview element VI rather than the de-queue VI.
 
Otherwise I am not real sure, can you attach your VI so we can take a look and help you find the solution?
0 Kudos
Message 2 of 9
(4,352 Views)
Hi Evan, I am using the Dequeue VI. Unfortunately, I can't attach my code, but I rewrote a simple one with the same idea (and problem!). Thanks.
0 Kudos
Message 3 of 9
(4,342 Views)
Here's the attachment
0 Kudos
Message 4 of 9
(4,342 Views)

Hey Sima,

The issue is the shift register in the deque loop.  The Q itself is flushing, however your shift regester array is not.  So by building up that array, you need to also "flush" the array in the loop.

Message 5 of 9
(4,334 Views)
Hi,
   I'm not sure what your "real" vi does, but in the example you sent the queue is flushed, but the shift register that you are using to show the results isn't. If you make one of the loops show unique data, in my case by wiring it to the loop counter through a  # to string conversion, you will see that the "remaining" string only shows what has been put on the queue since the last "flush".


P.M.


Faster typing 😉

Message Edited by LV_Pro on 01-23-2006 03:12 PM

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 6 of 9
(4,336 Views)
That was it. I got rid of the shift registers and just replaced with a local variable. Thanks!!
0 Kudos
Message 7 of 9
(4,325 Views)
Sima,

I rejiggered your .vi so that you could use shift registers.  Local variables can add unecessary complexity to programs.  I try to avoid them whenever possible.  I added two events to the event structure.  One is a timeout that updates "queued elements".  The other detects a change in the stop button.  When the stop is pressed, the queue is deallocated and the loop stopped.  I also changed the other two loops to die after the queue is dealocated.

=jason
Message 8 of 9
(4,308 Views)
Thank you, Jason.
0 Kudos
Message 9 of 9
(4,283 Views)