Using threads in Delphi

Using threads in Delphi

It's easy to use threads in Delphi.

Synchronize can be used well 🙂

Function

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;

How to use

WAIT (Procedure ()
 begin
   // .... detail
 END);

guest
0 Comments
Inline Feedbacks
View all comments