[Lazarus] SdpoSerial Tx and Rx buffers?

Bo Berglund bo.berglund at gmail.com
Tue Feb 15 20:53:36 CET 2011


On Tue, 15 Feb 2011 00:49:56 +0000, Paulo Costa <paco at fe.up.pt> wrote:

>Synaser is blocking both for writing and reading.
>The SdpoSerial component creates a thread to listen and generates an 
>event when bytes are received. So reading can be non-blocking.
>The write methods are direct calls to the Synaser ones and they are 
>blocking.

I just checked by setting up a transfer of 100.000 bytes at 38400
baud. With a breakpoint at the FComm.WriteData method I could time
this function using the step-over command. It returned in 30 s when
the packet was 100006 bytes long, an effective baudrate of 33300 baud.
So it really looks like the WriteData *is* blocking...

>For that, you must break your transmission in small block and use the 
>completion of each transfer to signal the progress.

Sadly this seems to be the case...

I would have to send in chunks of 1500 bytes or so to get 2 progress
ticks per second. The application will probably be stone dead and
nonresponsive too, which is one of the things I really like to
*always* avoid.

What one would need to do to fix this is to put the SdpoSerial into a
thread and let the thread send data out from a buffer that can be
loaded by the main application. But then we have the problem of
transferring the Tx data into the thread environment in a threadsafe
way...

My project just grew. :-(


Bo Berglund





More information about the Lazarus mailing list