Oppure

Loading
09/11/10 20:28
falaskhouse
come faccio ad eseguire due sub routine contemporaneamente? :) grazie in anticipo...
aaa
09/11/10 21:13
pierotofy
Devi usare i threads.
Il mio blog: piero.dev
10/11/10 13:55
falaskhouse
non è che potresti spiegarmi come si fa :)
aaa
11/11/10 16:46
pierotofy
Un esempio lo trovi qui: pierotofy.it/pages/sorgenti/browse/18393/4145/

Per maggiore documentazione, fai un po' di ricerca su CreateThread.
Il mio blog: piero.dev
12/11/10 14:46
Saladino
Questa è specifica per windows :

program Project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes ,windows
  { you can add units after this };

{$R *.res}

var
  Ok : boolean;
  ercode : longint;
  Thr ,th : longword;

procedure procedura1;
begin
//
//todo
//
MessageBox(0 ,'Thread in funzione' ,'' ,0);
end;

function Thread(P : pointer) : longint; stdcall;
begin
Ok := True;
procedura1;
Thread := 0;
end;

procedure procedura2;
begin
//
//todo
//
end;

begin
// ....
Thr := CreateThread(nil, 0, @Thread, nil, 0, Th);
repeat
 getexitcodethread(Thr ,@ercode);
until OK or (ercode <>still_active);
//if ok<>still_active then    errore
procedura2;
readln;
//.....
end.



aaa