Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: Circular buffers

2004-03-05 by Robert Adsett

At 04:01 AM 3/5/04 +0000, you wrote:
>This method has one problem.
>If the buffer fills up, then previous contents will get lost.
>ie. If you add 1024 bytes before taking any off then onpointer will
>be the same as offpointer and the whole buffer will be lost.

I'd check for it myself.  If a large buffer overflows it's worth knowing 
about since it may indicate the receiver process is starving and for a 
small buffer it may be essential to limit the data loss at high 
throughput.  If you wanted to get fancy you could add some sort of 
throttling logic.


>It does, however, look threadsafe (well interrupt safe anyway) and
>will be fine so long as you don't get too far behind.

You're right.  I had misread the test in the read routine.  As long as you 
don't try to do something like add multiple producers and consumers (and 
why would you for a serial routine), it'll be fine.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.