[Lazarus] Reading and writing TMemoryStream in events?

Henry Vermaak henry.vermaak at gmail.com
Mon Nov 8 13:52:48 CET 2010


On 08/11/10 12:26, Paul Breneman wrote:
> Michael Schnell wrote:
>> If the "Event" is just a normal (main-thread) event, there should be
>> no problem using whatever data structure in the normal way.
>>
>> f the "Event" is fired in a thread context, you need to use critical
>> sections top manage the mutual accesses. TThreadList does this for
>> you, so you might want to allocate a new chunk of the data when the
>> thread read it and add the pointer to the chunk in a TThreadList.
>
> I have used TThreadList as you mentioned for threaded serial
> communication (using SynaSer) with a console program under Linux.
>
> As you and I and others have discussed several times in the past several
> years, having some method for non-GUI messaging would seem nicer but my
> program just works with 1200 baud radio communication so using
> TThreadList and polling is fast enough for that. :)

Just curious, why don't you use select() instead of polling?

Henry




More information about the Lazarus mailing list