Showing results for 
Search instead for 
Did you mean: 

queue; two consumer loop problem

Go to solution

Hi everyone, 

ı have two consumer loop and I use only one obtain queue. I want to get the same data  at these consumer loops.How can ı solve this proplem.



0 Kudos
Message 1 of 9

Use the "Preview Queue" primitive to check the data and dequeue it in any of the loop or in the producer itself. Otherwise the element will not be removed and you will be always seeing the element (not reading) in one end and keep building the queue in the producer at the other end.


The best solution is the one you find it by yourself
0 Kudos
Message 2 of 9
Accepted by topic author enisçelik

You can not dequeue at two different places from the same queue.

if you have two consumer loops use 2 queue each for one loop.

and do not use more than one event structure in a single block diagram.

You need to follow some basis and think about architecture.

0 Kudos
Message 3 of 9

Thanks for your advice.I tried Preview Queue but  it gets the data only one time , if I change the data from producer loop it doesn't get the data again.Therefore I will use two different queue. 

Why I shouldn't use more than one event structure in a single block diagram?Can you explain?

0 Kudos
Message 4 of 9


and from image you have attached how do you plan to stop your program.

0 Kudos
Message 5 of 9

I use property node value signaling and I can stop the program.

0 Kudos
Message 6 of 9
Accepted by topic author enisçelik

Smiley Very Happy


OK , Did you read anything about design architecture in LabVIEW.

Three event structure on the same block diagram may lead to gui Lockup.

If someone press Boolean 2 or Boolean 3 , that loop will stop leaving the other loops running.

Then again if suppose loop 2 is running some task inside an event case and if you remove the lock front panel  checkmark , it wont run the new event case until it completes.

these are few from my side i am sure you will get lot more problems if you continue in that way.


PS : No need to use wait in while loop containing event strututre , you have left timeout terminal which means timeout is -1 . so the loop would not execute until any event happens.

You should use producer consumer architecture.

0 Kudos
Message 7 of 9

I'm not even seeing the point of the event structures in your consumer loops.  When you have no data in the queue, the Dequeue Element functions will sleep, using no CPU resources.  They will output something when there is data.


As was said, if you want two consumer loops, use two queues.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 9

I didn't use three event structure in one block diagram before but you're right,it will be problem. I consider to your advices. Thanks 

0 Kudos
Message 9 of 9