"thread-safe in delphi" Code Answer

1

my problem solved with synchronize!

type
  tmyworkerthread = class(tthread)
      public
         procedure execute; override;
  end;

var
  form1: tform1;

implementation

{$r *.dfm}

procedure tmyworkerthread.execute;
begin

  //codes that takes long time
  synchronize(procedure begin
     //working with visual components
  end
  );

end;

procedure tform1.button1click(sender: tobject);
begin
  tmyworkerthread.create(false);
end;

thank you all for helping me.

By Drfrink on February 9 2022

Answers related to “thread-safe in delphi”

Only authorized users can answer the Search term. Please sign in first, or register a free account.