IT ·

Uso dei thread in Delphi

Ecco un modo semplice per usare i thread in Delphi.

synchronize va usato con criterio 🙂

Contenuto della funzione

uses System.Classes, System.SysUtils, Vcl.Forms;

procedure Wait(Proc: TProc);
var
  Thread: TThread;
begin
  Thread := TThread.CreateAnonymousThread(procedure()
  begin
    Proc;
  end);
  Thread.FreeOnTerminate := True;
  Thread.Start;
  while not Thread.Finished do Application.ProcessMessages;
end;

Modalità d’uso

Wait(procedure()
begin
  // .... 내용
end);

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *