[Date Prev][Date Next] [Chronological] [Thread] [Top]

[rtl] fifo problem




Greetings,

RTLinux is working extremely well for my project.  But there's one area
that is causing me a problem....

I've got a rt task pumping sampled data into a fifo, on the Linux side
I have a java program that's reading data from the other end of that fifo.
The problem I'm having is when the java side goes to read data from the
fifo, I can't just grab all of what's there since I don't know how much
is waiting.  The additional catch is I don't want to block waiting for
bytes that haven't arrived yet.

For example:

// find out how many are waiting then grab them all without blocking
bytesWaiting = dataInputStream.available();
dataBuffer = new byte[ bytesWaiting ];
dataInputStream.read( dataBuffer );
etc....

By doing this I can ensure that I can keep up with the rt task that is
filling the fifo.  As long as the fifo is sufficiently large to buffer
all the data that arrives between trips to empty it, and I grab
as much as has accumulated since the last emptying.

Things would be simplified if I could do an 'available()' call.  What are
people doing in this situation?  Is there another way of looking at the 
problem?

Any assistance would be greatly appreciated!
Thanks,
Jim.



--- [rtl] ---
For more information on Real-Time Linux see:
http://www.rtlinux.org/