[Lazarus] Synchronize problem in linux

Giuliano Colla giuliano.colla at fastwebnet.it
Wed May 25 12:04:37 CEST 2011


Mattias Gaertner ha scritto:
> This might help:
> http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial
>
> Mattias
>
>   
I have a question related to this subject. Working with Borland's stuff 
(Kylix) I stumbled into a problem, and I'd like to know if the same 
applies also to Lazarus.

I had a multithread application with a thread which receives data 
through a communication line. I thought it safe to use a TStringList, 
which AFAIK is not a visual object. The main thread would create the 
StringList, the other thread would append strings to the list, and when 
it was done, the main thread would perform the required processing. The 
logic of the application itself made it sure that there was no conflict 
whatsoever. It turned out that it didn't work at all, silently filling 
with garbage the List, and I was forced to move all code related to the 
StringList in the main thread, with a slight overhead which, IMO should 
not have been necessary. I couldn't understand if it was a Kylix bug or 
a feature.

How would Lazarus behave with respect to this scenario? The scheme I 
described is expected to work?

Giuliano





More information about the Lazarus mailing list