[Lazarus] Synchronize problem in linux

Michael Van Canneyt michael at freepascal.org
Wed May 25 17:21:26 CEST 2011



On Wed, 25 May 2011, Zaher Dirkey wrote:

> 
> 
> On Wed, May 25, 2011 at 2:33 PM, <michael.vancanneyt at wisa.be> wrote:
> 
>
>             The full picture is:
>             1) The main thread creates the String List, and doesn't touch it any more.
>             2) The other thread is activated and it is the only one which appends strings to the list.
>             3) When the other thread is terminated, the main thread processes the list.
>
>             I would expect that whatever activity occurs as an effect of appending strings (such as reallocating the array) would occur in the
>             context of the thread performing the action, that all pertinent information is stored in fields of the object itself, and that the
>             main thread is never involved.  Am I wrong on this aspect?
> 
> 
> No, you are right. If it is designed as described above, then it should
> work.
> 
> Michael.
> 
>  
> But that mean he have only one thread worked at same time.

2 threads: 
The main thread takes care of the GUI (keeps the application responsive), 
while the second thread collects data, and notifies the main thread when 
it is done. The main thread then updates the GUI with the available data.

A simple scheme. I often do it like this.

Michael.


More information about the Lazarus mailing list