LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue Issue, reentrant/multiple calls

I have a slight problem using queues. I've read the posts that are close to my problem but i haven't figured out how to solve my case.

I have a "main window" where i want the queue to show constantly. Then i have 5 places that can add values to a single queue to be tested with a specific equipment. Even if i use 1 name for the queue the reference when obtaining the queue changes (read in a post). So i'm not able to modify 1 queue from 4 different places. I don't think it's appropriate to link from the "main window" the queue reference into the 5 places it should modify them.

So how should i solve my case? With reading the queue status from a Global Variable (not good solution)?
0 Kudos
Message 1 of 8
(3,784 Views)
Just to clarify.
The queues aren't in the same window as shown in the picture in the previous post. They are in completely different subvis.
0 Kudos
Message 2 of 8
(3,778 Views)
Hi Englund,

you shouldn't obtain and release the queue in the loop!
Obtain the queue only once before the while loop and release at the end. Wire the queue handle (output from "obtain queue") to all loops (or subvis) where you need to!

Message Edited by GerdW on 07-26-2007 01:13 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 8
(3,780 Views)
I know i should do it like that. But when the subVI isn't "the first VI" in the hierarchy in a complex system. So it's not that easy to just draw the reference wire to the right place. Is there another way of doing this? Writing queue reference into a global variable or other ways?
0 Kudos
Message 4 of 8
(3,774 Views)
When you open a queue by name you get a different queue ref to the same queue.

So you should be able to load the queue inside your subvi and post messages to the main VI without passing the reference around.
Be aware queues are bound to the application instance and you can't use them in a different app instance.
Just make sure that you keep the queue alive. So don't close it immediatly after writing to the queue.

Ton

Message Edited by TonP on 07-26-2007 01:20 PM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 5 of 8
(3,773 Views)
I tried that already, but for some reason it doesn't work. My picture that i provide writes a value to the "test" queue. I get the value inside the queue, but i can't read that specific queue in the top while loop.
0 Kudos
Message 6 of 8
(3,762 Views)
Thank you. I got it working, somehow. Still slight problems with the termination of a queue when a subvi closes, but i will ask further if i don't get it working.
0 Kudos
Message 7 of 8
(3,754 Views)
As I said keep the queue alive. Open the queue ref in your top VI and close it their when your application finishes (use a True to the Force destroy). In that way your subvis will get an error for any queue function.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 8 of 8
(3,736 Views)