LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

One Producer with Multiple Consumers

Solved!
Go to solution

Hi all,

 

I am trying to use the producer/consumer architecture in my program.  My producer loop is a analog input acquisition loop.  I would like to enqueue the acquired data for 3 separate consumers.  The first consumer loop would write the data to a file, the second consumer would send the data to the front panel, and the third consumer would send an analog output based on the data. 

 

It seems to me that if any of the consumer dequeue the data, the other consumers would have nothing left to dequeue.  I want them to get the same data at the same time.  Do I really have to create 3 queues and enqueue the same data to 3 separate queues?  Is there a better way?  Thanks!

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 3
(4,711 Views)
Solution
Accepted by topic author jyang72211

Yes.  That is what you need to do.  Perhaps someone else knows of some other exotic way to do this, but I think it would be way too complicated.

 

You can store the queue references in an array.  Wrap the enqueue function in a For Loop that takes the queue array in through an autoindexing tunnel.

0 Kudos
Message 2 of 3
(4,708 Views)

"Ravens Fan" <x@no.email> wrote in message
news:1235612404427-860519@exchange.ni.com...
> Yes.&nbsp; That is what you need to do.&nbsp; Perhaps someone else knows
of some other exotic way to do this, but I think it would be way too
complicated.&nbsp;You can store the queue references in an array.&nbsp; Wrap
the enqueue function in a For Loop that takes the queue array in through an
autoindexing tunnel.

This is the main reason I don't use queues. I use user events. The send user
events are received by all event structures registered to the user event,
and it blends in perfectly in the mmi code...

Regards,

Wiebe.


Message 3 of 3
(4,682 Views)