Hello,
Thank you for your help. I understand what you mean. I write my
program consequently. In my reading thread, I wait for data by
checking the input buffer index. Which increments as soon as the data
arrived.
Then, I think that is not important which I protect the buffer, but I
would like to know if I'm right.
Best regards.
Mariano.
JuanCarlos wrote in message news:<506500000005000000F6C70100-1079395200000@exchange.ni.com>...
> Mariano,
>
> The architecture that you have is commonly know as a producer/consumer
> application. There is one thread generating data and another thread
> reading it. The main problem with this setup is overwriting or
> overreading data; that is, the producer and consumers loop have
> different rates.
>
> the mai
n problem that you can find is that your reading thread reads
> the same data more than once. Or that your writing thread overwrites
> data that has not been read jet. If you can live with these type of
> errors you don't need buffer protection.
>
> If you need full data integrity and thread rate sinchronization you
> would need to use a thread safe queue. This way no data will be lost
> and you'll have correct sinchronization. you can find some examples at
> C:\Program Files\National
> Instruments\CVI70\samples\utility\Threading\ThreadSafeQueue. There is
> an example on no data loss for buffers that is a good place to start.
>
> I hope this helps, please let me know if you have any further
> questions.
>
> Regards.
>
> Juan Carlos
> N.I.