From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

RT FIFO -1 Timeout stops working if item isn't in FIFO when does read

If the RT FIFO read is set up to have a -1 timeout (ie. a -1 to the timeout in ms input to wait indefinitely.).  This behavior somewhat works.  It does wait indefinitely but it waits indefinitely regardless of if another element is written to the FIFO.  Therefore the program hangs and you can't read anything further.
0 Kudos
Message 1 of 5
(4,169 Views)
If you set the r/w modes input to be (blocking, polling) then the program no longer locks up the both sides of the FIFO and the program runs as desired.
0 Kudos
Message 2 of 5
(4,167 Views)

Can you post a simple test VI that shows this behavior? It seems likely that the Reader loop is thread-starving the writer loop since both were initially set to polling.

 

Richard

Field Sales Engineer, New Jersey
National Instruments
0 Kudos
Message 3 of 5
(4,160 Views)

Hi Richard,

I think you are correct in your logic.  I've attached my quickly developed test vi.

Further Notes:
If the timeout on the read loop is put to another number other than -1 say 10000, then the program is straved for that amount of time if when it enters the read no item is avaliable.

In order to view this behavior you will have to set the r/w mode to (polling, polling).

0 Kudos
Message 4 of 5
(4,151 Views)
Hi Ryan,

I hope you're doing well.  I actually ran into this behavior yesterday as well, and came to the same conclusion that Richard suggested: the RT FIFO Read is polling so fast that it is starving the RT FIFO Write from enqueing the next element.  We were able to solve it by simply changing the Read mode to blocking.  In conjunction with an infinite timeout, the read operation will sleep if there are no elements in the FIFO and then wake up when an element is finally queued up.  Let us know if this helps!

Thaison V
Applications Engineer
National Instruments

0 Kudos
Message 5 of 5
(4,122 Views)