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);

Leave a Reply

이메일 주소는 공개되지 않습니다. (* 질문, 건의사항 등은 "질문게시판"을 이용해주세요)