Using Threads in Delphi

Using Threads in Delphi

This is an easy way to work with threads in Delphi.

Just make sure to use synchronize properly 🙂

Function Details

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

procedure Wait(Proc: TProc);
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
  // .... content
end);

Leave a Reply

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