[fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-08 Thread vmst--- via fpc-pascal
I would like to create a buffer into which a thread can push incoming data and the main thread can extract it for processing. Data are coming from the serial port in a worker thread and should be consumed by the main thread. The data is a byte stream. Are there any good examples available? I have

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-08 Thread Brian via fpc-pascal
>Bo, > >Most of the users on this forum have never interfaced with hardware , as you >can see from the responses. Those who have interfaced with hardware have >developed circular buffers which they know work , and they reuse them again >and again. I did this about 10 years ago when working on a P

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-08 Thread Bo Berglund via fpc-pascal
On Mon, 7 Sep 2020 14:45:31 -0700 (MST), Brian via fpc-pascal wrote: >Bo, > >Most of the users on this forum have never interfaced with hardware , as you >can see from the responses. Those who have interfaced with hardware have >developed circular buffers which they know work , and they reuse th

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-07 Thread Brian via fpc-pascal
Bo, Most of the users on this forum have never interfaced with hardware , as you can see from the responses. Those who have interfaced with hardware have developed circular buffers which they know work , and they reuse them again and again. I will describe in general terms the structure a circul

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 17:44, Martin Frb via fpc-pascal wrote: type   TMyData = class       FData: array of byte;    end;   TMyThreadedQueue = specialize TLazThreadedQueue; Of course you can do   TMyData = array of byte;  // or record end if you want   TMyThreadedQueue = specialize TLazThreadedQueue

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 16:36, Bo Berglund via fpc-pascal wrote: A "simplest case" usage example would be nice to have. True. Once you got enough info from this thread, please write one. I still when looking at the sources have no clue as to how it would be used... It seems to me like at the very least

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Bo Berglund via fpc-pascal
On Thu, 3 Sep 2020 15:47:53 +0200, Martin Frb via fpc-pascal wrote: >On 03/09/2020 14:54, Bo Berglund via fpc-pascal wrote: >> Now to my question: >> Is there some *example* around for using TLazThreadedQueue as a >> circular buffer? >> In the examples dir are only examples for LazUnicode and >>

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 14:54, Bo Berglund via fpc-pascal wrote: Now to my question: Is there some *example* around for using TLazThreadedQueue as a circular buffer? In the examples dir are only examples for LazUnicode and LookUpStringList... And when reading the sources I cannot really say I understand wh

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Bo Berglund via fpc-pascal
On Thu, 3 Sep 2020 10:22:17 +0200, Martin Frb via fpc-pascal wrote: >On 03/09/2020 10:09, Bo Berglund via fpc-pascal wrote: >> I would like to create a buffer into which a thread can push incoming >> data and the main thread can extract it for processing. >> Data are coming from the serial port i

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 10:09, Bo Berglund via fpc-pascal wrote: I would like to create a buffer into which a thread can push incoming data and the main thread can extract it for processing. Data are coming from the serial port in a worker thread and should be consumed by the main thread. The data is a byt

[fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Bo Berglund via fpc-pascal
I would like to create a buffer into which a thread can push incoming data and the main thread can extract it for processing. Data are coming from the serial port in a worker thread and should be consumed by the main thread. The data is a byte stream. Are there any good examples available? I have