[Lazarus] Reading and writing TMemoryStream in events?

Paul Breneman list2010 at BrenemanLabs.com
Mon Nov 8 13:26:19 CET 2010


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.  :)

-- 
Regards,
Paul Breneman
www.dbReplication.com - VCL database replication components
www.TurboControl.com - Hardware and software development services
- Educational programming project for environment monitoring
- Information on using FreePascal for embedded systems
- Support information for the TurboPower open source libraries




More information about the Lazarus mailing list