[Lazarus] Synchronize problem in linux
Mattias Gaertner
nc-gaertnma at netcologne.de
Wed May 25 12:20:59 CEST 2011
On Wed, 25 May 2011 12:04:37 +0200
Giuliano Colla <giuliano.colla at fastwebnet.it> wrote:
> 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.
Correct.
> 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.
Ok. This should work if you use TThread to create the thread.
> 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?
Without more code I can only give the above link again.
Mattias
More information about the Lazarus
mailing list