01-30-2012 12:42 PM
Hello WORLD!
I have a producer consumer setup, where the the producer and consumer are in sepearte vi's. They have the same name, but are not communicating their existance to each other for the obtain queue function. As a result, only one is valid, the other ends up invalid. If I check the renum for each loop, they are different. Any guesses?
Solved! Go to Solution.
01-30-2012 12:55 PM
~~~~~Oh magic 8 ball~~~~
Did you wire T to "create if not found?" on only the second obtain queue that executed?
That would do it since the named queue wouldn't exist the first time and you did not give the function permission to create a named queue so- null reference out.
01-30-2012 01:07 PM - edited 01-30-2012 01:08 PM
yes, the T is wired by default, but I made sure to wire T for all the obtain queue
the producer vi initates and creates the queue. The queue is then valid.
Then the consumer vi initiates and ........? The queue in the producer vi becomes invalid.
Additionally, the consumer vi's refnum is different than the producer vi's refnum.
01-30-2012 01:20 PM
stripp it down to something that demonstrates the problem reproducably and post the example
01-30-2012 01:25 PM
force the second to run second and use a "F" instead.
Ben
01-30-2012 01:29 PM
Read the Detailed Help. See the part I underlined below.
"Use named queues to pass data between two sections of a block diagram or between two VIs in the same application instance. If you do not wire name, the function creates a new, unnamed queue reference. If you wire name, the function searches for an existing queue with the same name and returns a new reference to the existing queue. If a queue with the same name does not already exist and create if not found? is TRUE, the function creates a new, named queue reference."
Lynn
01-30-2012 01:37 PM
Well i wonder if it's possible a race condition can exist, where the queue (back channel) is obtained in two places at the same time. vi one obtains (back channel) then vi two obtains back channel almost immediately, it creates a new one because it cannot find the old queue?
can i put the obtain queue inside the loop and set it to F not create a new queue?
01-30-2012 02:45 PM
The destory queue was wired for true in the subvi, force destroy of the queue. So, the queue was being invalidated and then recreated in the other vi.
01-30-2012 03:06 PM
Ahhh so it wasn't the obtain reference that was the problem- it was that destryoing the queue somehow... sort of.... destoryed it or something.