On Thu, 18 Jan 2007 15:23:10 +0100
"Pieter Valentijn" <[EMAIL PROTECTED]> wrote:

> I think the same functions are in Lazarus as in Delphi right ?

See
http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial


> i.e.
> 
> Somewhere global
> var
>   aThreadLock : TRTLCriticalSection ;
> 
> In any procedure that calls the treadlist or tread actions that must
> finish before anny other actions take place you can use structures
> like this.
> 
> 
>         EnterCriticalSection(aThreadLock );
>         try
>           try
>            tablo:=TSqlite3Dataset.Create(Nil);
>            tablo.FileName:='db/services.db';
>            tablo.SQL:= 'select type_name, server_ip from servers where
> id='+ inttostr( record_id) ;
>            tablo.Active:=True; 
>            type_name:= tablo.FieldByName('type_name').AsString;
>            server_ip:= tablo.FieldByName('server_ip').AsString;
>           except 
>  
> main.StatusBar1.SimpleText:='thread1'+tablo.SqliteReturnString+tablo.SQL
> ;
>           end;
>         finally
>           LeaveCriticalSection(aThreadLock );
>         end;
>  end;
> 
> 
> I also gess lazars has the same Synchronize function like the one in
> Delphi
> 
> There you get this hint tekst
> 
> "Important: Methods and properties of objects in visual components can
> only be
>   used in a method called using Synchronize, for example,
> 
>       Synchronize(UpdateCaption);
> 
>   and UpdateCaption could look like,
> 
>     procedure ADSLUpdThread.UpdateCaption;
>     begin
>       Form1.Caption := 'Updated in a thread';
>     end;"


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to