NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Currently Being Moderated

Sending Data from Consumer to Producer Loop with User Events

VERSION 2

Created on: Jun 25, 2009 6:30 PM by Chris_G. - Last Modified:  Jun 25, 2009 6:35 PM by Chris_G.

The Producer Consumer design architecture is very good for being able to send data between parallel processes, without sacrificing CPU usage when used with an event structure in the producer loop.  The only issue which arises is if one tries to send data back up from the consumer to the producer.  If this is attempted using another Queue, you will quickly find that both loops are at a deadlock, since Dequeue Element is a blocking function, and if you try to circumvent this with a timeout on the function, you are essentially back to polling.  The attached ProducerConsumer_SendDataToProducer.vi demonstrates how to communicate data from the producer to the consumer using User Events.  When data is sent from the producer to the consumer, the consumer loop immediately generates a user event and sends the same data right back to the producer loop.

pic1.jpg

pic2.jpg

 

Downloads:
Average User Rating
(1 rating)




There are no comments on this document

More Like This

  • Retrieving data ...